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