Hi Everyone,
I recently installed a new Ansible host (Ubuntu Xenial, upgrading ansible from 1.9.4 to 2.0.0.2 in the process) and I can’t get the new host to use the ansible_become_pass
variable.
My plays always start by importing an ansible-vault encrypted file in which ansible_become_pass
is defined. I can see the variable is imported through - debug:
.
However, unless I use the -K flag Ansible fails shortly after with:
fatal: [
Remote-Computer]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "sudo: a password is required\r\n", "msg": "MODULE FAILURE", "parsed": false}
Passing the sudo password using -K works fine. The plays also still work fine on my 1.9.4 install.
Running the command as -vvvv:
`
ESTABLISH SSH CONNECTION FOR USER: ansible
SSH: EXEC sshpass -d14 ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o User=ansible -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ansible-ssh-%h-%p-%r -tt Remote-Computer ‘( umask 22 && mkdir -p “$( echo $HOME/.ansible/tmp/ansible-tmp-1461548589.83-187900167106488 )” && echo “$( echo $HOME/.ansible/tmp/ansible-tmp-1461548589.83-187900167106488 )” )’
PUT /tmp/tmpQuB4zJ TO /home/ansible/.ansible/tmp/ansible-tmp-1461548589.83-187900167106488/setup
SSH: EXEC sshpass -d14 sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o User=ansible -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ansible-ssh-%h-%p-%r ‘[Remote-Computer]’
ESTABLISH SSH CONNECTION FOR USER: ansible
SSH: EXEC sshpass -d14 ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o User=ansible -o ConnectTimeout=10 -o ControlPath=/home/ansible/.ansible/cp/ansible-ssh-%h-%p-%r -tt Remote-Computer ‘/bin/sh -c ‘"’“'sudo -H -S -n -u root /bin/sh -c '”’“'”‘"’“'”‘"’“‘echo BECOME-SUCCESS-ykcwgdxjxeyqbnmatwohoyxwtdpyljqj; LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1461548589.83-187900167106488/setup; rm -rf “/home/ansible/.ansible/tmp/ansible-tmp-1461548589.83-187900167106488/” > /dev/null 2>&1’”‘"’“'”‘"’“'”‘"’‘"’"‘’
fatal: [Remote-Computer]: FAILED! => {“changed”: false, “failed”: true, “invocation”: {“module_name”: “setup”}, “module_stderr”: “OpenSSH_7.2p2 Ubuntu-4, OpenSSL 1.0.2g-fips 1 Mar 2016\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 24837\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 1\r\nShared connection to Remote-Computer closed.\r\n”, “module_stdout”: “sudo: a password is required\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}
`
I can confirm ssh’ing into Remote-Computer and running only ``sudo -H -S -n -u root /bin/sh -c returns the "sudo: a password is required" message.
I've tried adding ``ansible_become_method
and ansible_become_user
as well.
Any assistance would be much appreciated.