# Problem with Playbook - one liner works

**URL:** <https://forum.ansible.com/t/problem-with-playbook-one-liner-works/20216>\
**Category:** Ansible Project\
**Tags:** vmware\
**Created:** [January 14, 2016, 4:45pm UTC](https://forum.ansible.com/t/problem-with-playbook-one-liner-works/20216 "2016-01-14T16:45:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arthur\_Francis](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Arthur\_Francis](https://forum.ansible.com/u/Arthur_Francis)\
**Post date:** [January 14, 2016, 4:45pm UTC](https://forum.ansible.com/t/problem-with-playbook-one-liner-works/20216/1 "2016-01-14T16:45:51Z")

</div>

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

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

```

Playbook

```auto
---
- hosts: vhosts
  remote_user: root

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

```

Playbook Error

```auto
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.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [January 14, 2016, 4:51pm UTC](https://forum.ansible.com/t/problem-with-playbook-one-liner-works/20216/2 "2016-01-14T16:51:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Arthur\_Francis](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Arthur\_Francis](https://forum.ansible.com/u/Arthur_Francis)\
**Post date:** [January 19, 2016, 5:15pm UTC](https://forum.ansible.com/t/problem-with-playbook-one-liner-works/20216/3 "2016-01-19T17:15:32Z")

</div>

That’s awesome Brian, it worked.

Thank you for the advice!
