# sudo: not found - but installed

**URL:** <https://forum.ansible.com/t/sudo-not-found-but-installed/21118>\
**Category:** Ansible Project\
**Created:** [April 10, 2016, 8:52am UTC](https://forum.ansible.com/t/sudo-not-found-but-installed/21118 "2016-04-10T08:52:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mark.breyer](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mark.breyer](https://forum.ansible.com/u/mark.breyer)\
**Post date:** [April 10, 2016, 8:52am UTC](https://forum.ansible.com/t/sudo-not-found-but-installed/21118/1 "2016-04-10T08:52:10Z")

</div>

Hi,

i have a strange problem with one of my ansible managed hosts.  
Error message:

FAILED! =\> {“changed”: false, “failed”: true, “module\_stderr”: “”, “module\_stdout”: “sudo: not found\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}

But sudo is installed and i managed the host for months with out problems.

me@example:/home/me # whereis sudo

sudo: /usr/local/bin/sudo /usr/local/man/man8/sudo.8.gz /usr/ports/security/sudo

uname -a:

FreeBSD [me.example.org](http://me.example.org) 10.3-RELEASE FreeBSD 10.3-RELEASE #0 r297264: Fri Mar 25 02:10:02 UTC 2016 [root@releng1.nyi.freebsd.org](mailto:root@releng1.nyi.freebsd.org):/usr/obj/usr/src/sys/GENERIC amd64

Here is the verbose error message:

\<[hostname.example.org](http://hostname.example.org)\> ESTABLISH SSH CONNECTION FOR USER: ansible

\<[hostname.example.org](http://hostname.example.org)\> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=2222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -tt [hostname.example.org](http://hostname.example.org) ‘/bin/sh -c ‘"’"’( umask 22 && mkdir -p “`echo $HOME/.ansible/tmp/ansible-tmp-1460277972.44-221877909670031`” && echo “`echo $HOME/.ansible/tmp/ansible-tmp-1460277972.44-221877909670031`” )‘"’"‘’

\<[hostname.example.org](http://hostname.example.org)\> PUT /tmp/tmpj07XGK TO /home/ansible/.ansible/tmp/ansible-tmp-1460277972.44-221877909670031/setup

\<[hostname.example.org](http://hostname.example.org)\> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=2222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r ‘[[hostname.example.org](http://hostname.example.org)]’

\<[hostname.example.org](http://hostname.example.org)\> ESTABLISH SSH CONNECTION FOR USER: ansible

\<[hostname.example.org](http://hostname.example.org)\> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=2222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -tt [hostname.example.org](http://hostname.example.org) ‘/bin/sh -c ‘"’“'sudo -H -S -n -u root /bin/sh -c '”’“'”‘"’“'”‘"’“'echo BECOME-SUCCESS-hnsuuegbwwfxovpkaayhtkvdzmguwtww; /bin/sh -c '”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘“‘LANG=en\_US.UTF-8 LC\_ALL=en\_US.UTF-8 LC\_MESSAGES=en\_US.UTF-8 /usr/local/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1460277972.44-221877909670031/setup; rm -rf “/home/ansible/.ansible/tmp/ansible-tmp-1460277972.44-221877909670031/” \> /dev/null 2\>&1’”’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“'”‘"’“‘’”‘"’“'”‘"’“'”‘"’‘"’"‘’

fatal: [[hostname.example.org](http://hostname.example.org)]: FAILED! =\> {“changed”: false, “failed”: true, “invocation”: {“module\_name”: “setup”}, “module\_stderr”: “OpenSSH\_7.2p2, OpenSSL 1.0.1s-freebsd 1 Mar 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh\_config\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 4 setting O\_NONBLOCK\r\ndebug2: mux\_client\_hello\_exchange: master version 4\r\ndebug3: mux\_client\_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux\_client\_request\_session: entering\r\ndebug3: mux\_client\_request\_alive: entering\r\ndebug3: mux\_client\_request\_alive: done pid = 6633\r\ndebug3: mux\_client\_request\_session: session request sent\r\ndebug1: mux\_client\_request\_session: master session id: 2\r\ndebug3: mux\_client\_read\_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 127\r\nShared connection to [hostname.example.org](http://hostname.example.org) closed.\r\n”, “module\_stdout”: “sudo: not found\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}

I have this problem only with one host, all others are working fine.

Does anyone have an idea?

Thanks

Mark

---

<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:** [April 14, 2016, 1:04pm UTC](https://forum.ansible.com/t/sudo-not-found-but-installed/21118/2 "2016-04-14T13:04:53Z")

</div>

It looks like /usr/local/bin is not in the path when ansible logs in (it does not do an interactive login so if you are setting the path there it won’t be available to ansible), try setting sudo\_exe=/usr/local/bin/sudo in ansible.cfg
