Ansible 1.9.1 ‘become’ and sudo issue

Question:

I am trying to run an extremely simple playbook to test a new Ansible setup.

When using the ‘new’ Ansible Privilege Escalation config options in my ansible.cfg file:

I get the following error:

The playbook is also very simple:

I am not sure if there is something broken in Ansible 1.9.1 or if I am doing something wrong. Surely the ‘command’ module in Ansible allows running commands as sudo.

Answer:

The issue is with configuration; I also took it as an example and got the same problem. After playing awhile I noticed that the following works:

1) deprecated sudo:

2) new become

3) using ansible.cfg:

and then in a playbook:

since you “becoming” tstuser01 (not a root like me), please play a bit, probably user name should not be quoted too:

at least this is the way I define remote_user in ansible.cfg and it works… My issue resolved, hope yours too

Leave a Reply