Problem with Playbook - one liner works

293 views
Skip to first unread message

Arthur Francis

unread,
Jan 14, 2016, 11:48:46 AM1/14/16
to Ansible Project

could somebody please help, I am trying to create an Ansible playbook for our VMWare virtual hosts but the playbook will not work. If I run the same command on its own, it succeeds.

Single command which works


ansible vhosts -vvv -k -m shell -a "vmkfstools -Ph -v 1 /vmfs/volumes/VMFS_01 | grep Mode"


Playbook


---
- hosts: vhosts
  remote_user: root

  tasks:
    - name: Get VMFS 01
      shell: vmkfstools -Ph -v 1 /vmfs/volumes/VMFS_01 | grep Mode


Playbook Error


fatal: [10.10.10.3]: FAILED! => {"msg": "/bin/sh: sudo: not found
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 1810
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 127
Shared connection to 10.10.10.3 closed.
", "failed": true, "changed": false, "parsed": false, "invocation": {"module_name": "setup", "module_args": {}}}


ansible 2.0.0


In fact I have tried some basic modules inside the playbook and they all seem to give the same error.

Brian Coca

unread,
Jan 14, 2016, 11:51:24 AM1/14/16
to Ansible Project
try adding gather_facts: false to avoid running the setup module (you
don't seem to need it here), also check that you don't have sudo
enabled in ansible.cfg, as the error suggest you are tying to use it
when not present. Or you can just turn it off for that pllay.

---
- hosts: vhosts
gather_facts: false
sudo: no
remote_user: root






--
Brian Coca

Arthur Francis

unread,
Jan 19, 2016, 12:15:32 PM1/19/16
to Ansible Project
That's awesome Brian, it worked.

Thank you for the advice!
Reply all
Reply to author
Forward
0 new messages