fatal: [Remote-Computer]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "sudo: a password is required\r\n", "msg": "MODULE FAILURE", "parsed": false}<Remote-Computer> ESTABLISH SSH CONNECTION FOR USER: ansible
<Remote-Computer> 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 )" )'
<Remote-Computer> PUT /tmp/tmpQuB4zJ TO /home/ansible/.ansible/tmp/ansible-tmp-1461548589.83-187900167106488/setup
<Remote-Computer> 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]'
<Remote-Computer> ESTABLISH SSH CONNECTION FOR USER: ansible
<Remote-Computer> 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}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.#| Import encrypted host variables
- hosts: all
vars_files:
- host_vars/{{inventory_
hostname}}.yml
- host_vars/{{inventory_hostname}}-encrypted.yml # <-- ansible_become_pass stored here
tags: [ 'always' ]
#| Initialization, run before further plays
- name: Initialize with Core Plays
hosts: all
become: yes
roles:
- role: users
- role: hosts
tags: [ 'initialize' ]#| Initialization, run before further plays
- name: Initialize with Core Plays
hosts: all
become: yes
vars_files:
- host_vars/{{inventory_hostname}}.yml
- host_vars/{{inventory_hostname}}-encrypted.yml
roles:
- role: users
- role: hosts
tags: [ 'initialize' ]ansible_become_pass is now imported and available for all my plays.`{{inventory_hostname}}-encrypted.yml` available for all subsequent plays.- hosts: all
vars_files:
- host_vars/{{inventory_hostname}}.yml
- host_vars/{{inventory_hostname}}-encrypted.yml
tags: [ 'always' ]