# request help with configuration issue: 'sudo: True' has no effect.

**URL:** <https://forum.ansible.com/t/request-help-with-configuration-issue-sudo-true-has-no-effect/15006>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 13, 2014, 6:18am UTC](https://forum.ansible.com/t/request-help-with-configuration-issue-sudo-true-has-no-effect/15006 "2014-04-13T06:18:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joel\_Hughes](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Joel\_Hughes](https://forum.ansible.com/u/Joel_Hughes)\
**Post date:** [April 13, 2014, 6:18am UTC](https://forum.ansible.com/t/request-help-with-configuration-issue-sudo-true-has-no-effect/15006/1 "2014-04-13T06:18:29Z")

</div>

sudo: True has no effect  
This is a **configuration issue** ; hoping someone can spot my mistake.

Tested against Ansible versions: 1.4.5, 1.5.0 through 1.5.4, and devel branch; so I’m quite certain it is not an ansible issue.  
Host OS: Ubuntu 12.04.4 fully patched  
**both ssh and sudo are passwordless**

cat /etc/sudoers.d/admin  
jhughes ALL=(ALL) NOPASSWD:ALL

**ansible.cfg** changes from default  
hostfile = /srv/ansible/playbook/hosts #NOTE: tested against two nodes, only one listed below for brevity.

sudo\_user = jhughes

log\_path = /var/log/ansible/ansible.log

private\_key\_file = /srv/ansible/playbook/files/ssl/id\_rsa #NOTE: this matches the private key of jhughes

pipelining = True #NOTE: testing with pipelining on and off

Notice in the output below there is no reference to ‘sudo’. I’m expecting to see something similar to:

`...'grolsch', u'/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=l...`

Test playbook (below): test\_sudo.yml  
Invoked with:

1. ansible-playbook -vvvv playbook/test\_sudo.yml

2. ansible-playbook -vvvv playbook/test\_sudo.yml --sudo -K

file: test\_sudo.yml

`

---

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [April 14, 2014, 8:39pm UTC](https://forum.ansible.com/t/request-help-with-configuration-issue-sudo-true-has-no-effect/15006/2 "2014-04-14T20:39:24Z")

</div>

This is working exactly as directed… I would remove sudo\_user: myself but you could alternately set it to sudo\_user: root.

The default for sudo is for it to switch to root, but if you set sudo\_user it’s the equivalent of running sudo -u \<user\_name\> which runs the command as the provided \<user\_name\>.

I hope that this helps,

Adam

---

<div class="post-metadata">

**Author:** ![Joel\_Hughes](https://avatars.discourse-cdn.com/v4/letter/j/b9e5f3/32.png) [@Joel\_Hughes](https://forum.ansible.com/u/Joel_Hughes)\
**Post date:** [April 14, 2014, 9:04pm UTC](https://forum.ansible.com/t/request-help-with-configuration-issue-sudo-true-has-no-effect/15006/3 "2014-04-14T21:04:27Z")

</div>

The issue was the setting of sudo\_user, as you described. I had set it in ansible.cfg and then was adding/removing in the playbook during troubleshooting. With sudo\_user set to the default or ‘root’ in ansible.cfg, ‘sudo: True’ operations are behaving as expected.  
Thanks for leading me in the correct direction.  
Joel
