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

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

`

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

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