Good morning,

I am attempting to use the (shell:) command to obtain the disk space for a 
remote host.  Once I get the command working, I'll then use AWK to filter 
the output.

However, the below example playbook insists on running the (shell:) command 
on the local Ansible control machine, and not the remote host (server1).  
Thus, I end up with disk space (/var) for the Ansible machine, and NOT the 
remote host (server1).  Does anyone know how what I may be doing wrong?  
Other commands for example (bigip_command:) run on the remote host fine.

If I enter a directory (chdir:) that only exists on the remote host, 
Ansible throws an error like "Directory does not exist", which is true, as 
it is looking on the local machine.

Thank you!

- name: Test Playbook
  hosts: server1
  connection: local
  gather_facts: true
   

  - name: Display Disk Space

    shell:

      cmd: df /var
      chdir: /var
    register: disk_space_output

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ce88ea03-b22d-4a5a-a21b-e475517a0676n%40googlegroups.com.

Reply via email to