`
- hosts: DEV1
become: yes
tasks: - name: “Update linux headers”
apt:
name: “linux-headers-{{ ansible_kernel }}”
`
After running this the ansible hangs after fact gathering. Please find the output below:
`
ansibleuser@debian:~/ansible_code$ ansible-playbook -vvv playbooks/second-playbook.yaml
ansible-playbook 2.9.11
config file = /home/ansibleuser/ansible_code/ansible.cfg
configured module search path = [‘/home/ansibleuser/.ansible/plugins/modules’, ‘/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/local/lib/python3.5/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 3.5.3 (default, Jul 9 2020, 13:00:10) [GCC 6.3.0 20170516]
Using /home/ansibleuser/ansible_code/ansible.cfg as config file
host_list declined parsing /home/ansibleuser/ansible_code/inventory as it did not pass its verify_file() method
script declined parsing /home/ansibleuser/ansible_code/inventory as it did not pass its verify_file() method
auto declined parsing /home/ansibleuser/ansible_code/inventory as it did not pass its verify_file() method
Parsed /home/ansibleuser/ansible_code/inventory inventory source with ini plugin
PLAYBOOK: second-playbook.yaml *********************************************************************************************************************************
1 plays in playbooks/second-playbook.yaml
PLAY [DEV1] ****************************************************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************************************
task path: /home/ansibleuser/ansible_code/playbooks/second-playbook.yaml:1
<192.168.1.153> ESTABLISH SSH CONNECTION FOR USER: idriveadmin
<192.168.1.153> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o Port=1460 -o ‘IdentityFile=“/home/ansibleuser/ansibleuserkey”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“idriveadmin”’ -o ConnectTimeout=10 -o ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd 192.168.1.153 ‘/bin/sh -c ‘"’“‘echo ~idriveadmin && sleep 0’”’“‘’
<192.168.1.153> (0, b’/home/idriveadmin\n’, b’')
<192.168.1.153> ESTABLISH SSH CONNECTION FOR USER: idriveadmin
<192.168.1.153> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o Port=1460 -o 'IdentityFile=”/home/ansibleuser/ansibleuserkey"’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“idriveadmin”’ -o ConnectTimeout=10 -o ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd 192.168.1.153 ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “echo /home/idriveadmin/.ansible/tmp
”&& mkdir /home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896 && echo ansible-tmp-1596646753.1827192-28335-58868948093896=“echo /home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896
” ) && sleep 0’“'”‘’
<192.168.1.153> (0, b’ansible-tmp-1596646753.1827192-28335-58868948093896=/home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896\n’, b’‘)
Attempting python interpreter discovery
<192.168.1.153> ESTABLISH SSH CONNECTION FOR USER: idriveadmin
<192.168.1.153> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o Port=1460 -o ‘IdentityFile=“/home/ansibleuser/ansibleuserkey”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“idriveadmin”’ -o ConnectTimeout=10 -o ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd 192.168.1.153 ‘/bin/sh -c ‘"’“'echo PLATFORM; uname; echo FOUND; command -v '”’"’“'”‘"’“'”‘"’/usr/bin/python’“'”‘"’“'”‘"’“'”‘; command -v ‘"’"’“'”‘"’“'”‘“‘python3.7’”’“'”‘"’“'”‘"’“'; command -v '”‘"’“'”‘"’“'”‘“‘python3.6’”’“'”‘"’“'”‘"’“'; command -v '”‘"’“'”‘"’“'”‘“‘python3.5’”’“'”‘"’“'”‘"’“'; command -v '”‘"’“'”‘"’“'”‘“‘python2.7’”’“'”‘"’“'”‘"’“'; command -v '”‘"’“'”‘"’“'”‘“‘python2.6’”’“'”‘"’“'”‘"’“'; command -v '”‘"’“'”‘"’“'”‘"’/usr/libexec/platform-python’“'”‘"’“'”‘"’“'”‘; command -v ‘"’"’“'”‘"’“'”‘"’/usr/bin/python3’“'”‘"’“'”‘"’“'”‘; command -v ‘"’"’“'”‘"’“'”‘“‘python’”’“'”‘"’“'”‘"’“‘; echo ENDFOUND && sleep 0’”‘"’’
<192.168.1.153> (0, b’PLATFORM\nLinux\nFOUND\n/usr/bin/python\n/usr/local/bin/python3.6\n/usr/bin/python3.5\n/usr/bin/python2.7\n/usr/bin/python3\n/usr/bin/python\nENDFOUND\n’, b’‘)
<192.168.1.153> ESTABLISH SSH CONNECTION FOR USER: idriveadmin
<192.168.1.153> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o Port=1460 -o ‘IdentityFile=“/home/ansibleuser/ansibleuserkey”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“idriveadmin”’ -o ConnectTimeout=10 -o ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd 192.168.1.153 ‘/bin/sh -c ‘"’"’/usr/bin/python && sleep 0’“'”‘’
<192.168.1.153> (0, b’{“osrelease_content”: “PRETTY_NAME=\“Debian GNU/Linux 9 (stretch)\”\nNAME=\“Debian GNU/Linux\”\nVERSION_ID=\“9\”\nVERSION=\“9 (stretch)\”\nVERSION_CODENAME=stretch\nID=debian\nHOME_URL=\“https://www.debian.org/\\“\\nSUPPORT_URL=\\“https://www.debian.org/support\\”\\nBUG_REPORT_URL=\\“https://bugs.debian.org/\\”\\n”, “platform_dist_result”: [“debian”, “9.11”, “”]}\n’, b’')
Python interpreter discovery fallback (unsupported Linux distribution: debian)
Using module file /usr/local/lib/python3.5/dist-packages/ansible/modules/system/setup.py
<192.168.1.153> PUT /home/ansibleuser/.ansible/tmp/ansible-local-28329eia3qjsx/tmpb0q749yy TO /home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896/AnsiballZ_setup.py
<192.168.1.153> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o Port=1460 -o 'IdentityFile=”/home/ansibleuser/ansibleuserkey”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“idriveadmin”’ -o ConnectTimeout=10 -o ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd ‘[192.168.1.153]’
<192.168.1.153> (0, b’sftp> put /home/ansibleuser/.ansible/tmp/ansible-local-28329eia3qjsx/tmpb0q749yy /home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896/AnsiballZ_setup.py\n’, b’‘)
<192.168.1.153> ESTABLISH SSH CONNECTION FOR USER: idriveadmin
<192.168.1.153> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o Port=1460 -o ‘IdentityFile=“/home/ansibleuser/ansibleuserkey”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“idriveadmin”’ -o ConnectTimeout=10 -o ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd 192.168.1.153 ‘/bin/sh -c ‘"’“‘chmod u+x /home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896/ /home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896/AnsiballZ_setup.py && sleep 0’”’"’’
<192.168.1.153> (0, b’‘, b’‘)
<192.168.1.153> ESTABLISH SSH CONNECTION FOR USER: idriveadmin
<192.168.1.153> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o Port=1460 -o ‘IdentityFile=“/home/ansibleuser/ansibleuserkey”’ -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“idriveadmin”’ -o ConnectTimeout=10 -o ControlPath=/home/ansibleuser/.ansible/cp/a5ab6003fd -tt 192.168.1.153 ‘/bin/sh -c ‘"’“'sudo -H -S -n -u root /bin/sh -c '”’"’“'”‘"’“'”‘“‘echo BECOME-SUCCESS-lrghmoionoknwyoynanrcjziykyevqfo ; /usr/bin/python /home/idriveadmin/.ansible/tmp/ansible-tmp-1596646753.1827192-28335-58868948093896/AnsiballZ_setup.py’”’“'”‘"’“'”‘"’“’ && sleep 0’”‘"’’
Escalation succeeded
`
But the connection to DEV1 host is fine. Below is the output:
ansibleuser@debian:~/ansible_code$ ansible DEV1 -m ping [WARNING]: Platform linux on host DEV1 is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change this. See https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more information. DEV1 | SUCCESS => { "ansible_facts": { "discovered_interpreter_python": "/usr/bin/python" }, "changed": false, "ping": "pong" }
Please help in correcting me.