# BECOME password:

**URL:** <https://forum.ansible.com/t/become-password/31645>\
**Category:** Ansible Project\
**Created:** [November 12, 2019, 8:11pm UTC](https://forum.ansible.com/t/become-password/31645 "2019-11-12T20:11:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy\_Wright](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@Roy\_Wright](https://forum.ansible.com/u/Roy_Wright)\
**Post date:** [November 12, 2019, 8:11pm UTC](https://forum.ansible.com/t/become-password/31645/1 "2019-11-12T20:11:21Z")

</div>

Howdy,

I have a Jenkins job that SSHes to a VM that has ansible installed. The job creates an LXC container on the VM then populates the container with the test environment.

Can some kind soul please point me to the magic incantation for running ansible-playback without prompting for the BECOME password?

When ansible-playback -vvv is ran I always get:

ansible-playbook 2.9.0  
config file = /home/myuser/projects/test-ansible/ansible.cfg  
configured module search path = [u’/home/myuser/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]  
ansible python module location = /usr/lib/python2.7/dist-packages/ansible  
executable location = /usr/bin/ansible-playbook  
python version = 2.7.15+ (default, Oct 7 2019, 17:39:04) [GCC 7.4.0]  
Using /home/myuser/projects/test-ansible/ansible.cfg as config file  
BECOME password:

and the job hangs until timeout.

I’ve tried:

- /etc/sudoers: ALL=(ALL:ALL) NOPASSWD: ALL  
for root + the user account

- ansible-playback … --extra-vars=ansible\_sudo\_pass={user-container-password}

- ansible-playback … --extra-vars=ansible\_sudo\_pass={host-vm-password}

- ansible-playback … --extra-vars=ansible\_become\_pass={user-container-password}

- ansible-playback … --extra-vars=ansible\_become\_pass={host-vm-password}

- ansible-playback … --extra-vars=private-key=$HOME/.ssh/id\_pub

# note this is after copying $HOME/.ssh to the container

All of the above with and without: -b

In the playbook:

…  
hosts:  
{host-vm-ipaddr}:

ansible\_password: {user-container-password}

ansible\_ssh\_pass: {user-container-password}

ansible\_become\_password: {user-container-password}

ansible\_sudo\_password: {user-container-password}  
ansible\_sudo\_flags: -H -S

- several permutations of sudo when running ansible-playback, no joy.

Thank you,  
Roy

---

<div class="post-metadata">

**Author:** ![sdoran](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@sdoran](https://forum.ansible.com/u/sdoran)\
**Post date:** [November 13, 2019, 7:02pm UTC](https://forum.ansible.com/t/become-password/31645/2 "2019-11-13T19:02:32Z")

</div>

Roy,

Check the settings in /home/myuser/projects/test-ansible/ansible.cfg. Always being prompted for the become password seems to indicate become\_ask\_pass=True is set in the configuration.

You can also see the current configuration by running ansible-config dump --only-changed.

---

<div class="post-metadata">

**Author:** ![Roy\_Wright](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@Roy\_Wright](https://forum.ansible.com/u/Roy_Wright)\
**Post date:** [November 18, 2019, 4:57pm UTC](https://forum.ansible.com/t/become-password/31645/3 "2019-11-18T16:57:35Z")

</div>

Thank you for the suggestions, alas no joy:

➤ cat ansible.cfg  
[defaults]

# On our servers, root does not have access to users’ network-mounted home directories. So we cannot rely on ansible’s

# default `~/.ansible/tmp/...` location for temporary files. The user you use to connect to the target server must also

# have write access to this directory.

remote\_tmp = /tmp

➤ ansible-config dump | grep BECOME  
AGNOSTIC\_BECOME\_PROMPT(default) = True  
BECOME\_ALLOW\_SAME\_USER(default) = False  
BECOME\_PLUGIN\_PATH(default) = [u’/home/myuser/.ansible/plugins/become’, u’/usr/share/ansible/plugins/become’]  
DEFAULT\_BECOME(default) = False  
DEFAULT\_BECOME\_ASK\_PASS(default) = False  
DEFAULT\_BECOME\_EXE(default) = None  
DEFAULT\_BECOME\_FLAGS(default) =  
DEFAULT\_BECOME\_METHOD(default) = sudo  
DEFAULT\_BECOME\_USER(default) = root

I ended up going ugly and just wrapping the ansible call with expect to handle the BECOME password prompt.

Thank you,  
Roy
