I am a noob at ansible, and I am trying to learn it to automate log 
collection for our lab. My yaml file is right below: Executing this gives 
me an error near the second set of tasks. I am searching everyhwere but 
what  am actually confused about is this:. Is this allowed ? As far as I 
have read, hosts: x tasks: A hosts:y tasks:B should be allowed. Then why am 
i seeing this error?
Thanks,
Surya




---
- name: Transfer script, get the file
  hosts: qemu_vm
  sudo: yes
  tasks:
        - name: Transfer the script to remote host
          copy: src=~/CPU_logs.sh dest=~ mode=0777

        - name: Execute the script on Remote host
          command: sh ~/CPU_logs.sh

        - name: Get the file
          fetch:
                src: ~/CPU_logs.csv
                dest: /var/customlogs/logs/{{ inventory_hostname }}
                flat: yes

- name : Run script on host, save the file in /var/customlogs
  hosts: host_vm
  sudo: yes
  tasks:
        - name: Run the script
          command: sh ~/CPU_logs.sh

        - name: Get the file
          fetch:
                src: ~/CPU_logs.csv
                dest: /var/customlogs/logs/{{ inventory_hostname }}
                flat: yes

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c7f20987-881f-46cb-94e0-347e86889eaa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to