I just installed Ansible and trying a simple ping but getting errors. below is the output of the command:
test-switch | FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"module_stderr": "Shared connection to test-switch closed.\r\n",
"module_stdout": "\r\nLine has invalid autocommand \"/bin/sh -c '/usr/bin/python '\"'\"'Line has invalid autocommand \"/bin/sh -c '\"'\"'\"'\"'\"'\"'\"'\"'( umask 77 && mkdir -p \"` echo Line has invalid autocommand \"/bin/sh -c '\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'echo ~**** && sleep 0'\"'\"'\"'\"'\"",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 0
}
Here is some extra info:
user@server:~$ sudo ansible test -m ping -i test-hosts -vvv
ansible [core 2.13.3]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.10.4 (main, Jun 29 2022, 12:14:53) [GCC 11.2.0]
jinja version = 3.0.3
libyaml = True
Using /etc/ansible/ansible.cfg as config file
host_list declined parsing /home/user/test-hosts as it did not pass its verify_file() method
script declined parsing /home/user/test-hosts as it did not pass its verify_file() method
auto declined parsing /home/user/test-hosts as it did not pass its verify_file() method
Parsed /home/user/test-hosts inventory source with ini plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
META: ran handlers
<test-switch> ESTABLISH SSH CONNECTION FOR USER: ****
<test-switch> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="****"' -o ConnectTimeout=30 -o 'ControlPath="/root/.ansible/cp/e7f6d09650"' test-switch '/bin/sh -c '"'"'echo ~**** && sleep 0'"'"''
<test-switch> (0, b'\r\nLine has invalid autocommand "/bin/sh -c \'echo ~**** && sleep 0\'"', b'')
<test-switch> ESTABLISH SSH CONNECTION FOR USER: ****
<test-switch> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="****"' -o ConnectTimeout=30 -o 'ControlPath="/root/.ansible/cp/e7f6d09650"' test-switch '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"/.ansible/tmp/ansible-tmp-1662641931.939476-3032-59266234632066 `" && echo ansible-tmp-1662641931.939476-3032-59266234632066="` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"/.ansible/tmp/ansible-tmp-1662641931.939476-3032-59266234632066 `" ) && sleep 0'"'"''
<test-switch> (0, b'\r\nLine has invalid autocommand "/bin/sh -c \'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c \'"\'"\'echo ~**** && sleep 0\'"\'"\'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c \'"\'"\'echo ~**** && sleep 0\'"\'"\'"/.ansible/tmp/a"', b'')
<test-switch> Attempting python interpreter discovery
<test-switch> ESTABLISH SSH CONNECTION FOR USER: ****
<test-switch> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="****"' -o ConnectTimeout=30 -o 'ControlPath="/root/.ansible/cp/e7f6d09650"' test-switch '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'python3.10'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.9'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.8'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<test-switch> (0, b'\r\nLine has invalid autocommand "/bin/sh -c \'echo PLATFORM; uname; echo FOUND; command -v \'"\'"\'python3.10\'"\'"\'; command -v \'"\'"\'python3.9\'"\'"\'; command -v \'"\'"\'python3.8\'"\'"\'; command -v \'"\'"\'python3.7\'"\'"\'; command -v \'"\'"\'python3.6\'"\'"\'; command -v \'"\'"\'python3.5\'"\'"\'; command -v \'"\'"\'"', b'')
[WARNING]: Unhandled error in Python interpreter discovery for host test-switch: unexpected output from Python interpreter discovery
Using module file /usr/lib/python3/dist-packages/ansible/modules/ping.py
<test-switch> PUT /root/.ansible/tmp/ansible-local-3029qijo7fpq/tmp0dni2qsr TO Line has invalid autocommand "/bin/sh -c '( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c '"'"'echo ~**** && sleep 0'"'"'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c '"'"'echo ~**** && sleep 0'"'"'"/.ansible/tmp/a"/AnsiballZ_ping.py
<test-switch> SSH: EXEC sshpass -d10 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="****"' -o ConnectTimeout=30 -o 'ControlPath="/root/.ansible/cp/e7f6d09650"' '[test-switch]'
[WARNING]: sftp transfer mechanism failed on [test-switch]. Use ANSIBLE_DEBUG=1 to see detailed information
<test-switch> SSH: EXEC sshpass -d10 scp -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="****"' -o ConnectTimeout=30 -o 'ControlPath="/root/.ansible/cp/e7f6d09650"' /root/.ansible/tmp/ansible-local-3029qijo7fpq/tmp0dni2qsr '[test-switch]:'"'"'Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"/.ansible/tmp/a"/AnsiballZ_ping.py'"'"''
[WARNING]: scp transfer mechanism failed on [test-switch]. Use ANSIBLE_DEBUG=1 to see detailed information
<test-switch> ESTABLISH SSH CONNECTION FOR USER: ****
<test-switch> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="****"' -o ConnectTimeout=30 -o 'ControlPath="/root/.ansible/cp/e7f6d09650"' test-switch 'dd of=Line has invalid autocommand "/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"/.ansible/tmp/a"/AnsiballZ_ping.py bs=65536'
<test-switch> (0, b'\r\nLine has invalid autocommand "dd of=Line has invalid autocommand "/bin/sh -c \'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c \'"\'"\'echo ~**** && sleep 0\'"\'"\'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c \'"\'"\'echo ~svc_ansib"', b'')
<test-switch> (0, b'\r\nLine has invalid autocommand "dd of=Line has invalid autocommand "/bin/sh -c \'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c \'"\'"\'echo ~**** && sleep 0\'"\'"\'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c \'"\'"\'echo ~svc_ansib"', b'')
<test-switch> ESTABLISH SSH CONNECTION FOR USER: ****
<test-switch> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="****"' -o ConnectTimeout=30 -o 'ControlPath="/root/.ansible/cp/e7f6d09650"' test-switch '/bin/sh -c '"'"'chmod u+x '"'"'"'"'"'"'"'"'Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"/.ansible/tmp/a"/'"'"'"'"'"'"'"'"' '"'"'"'"'"'"'"'"'Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"/.ansible/tmp/a"/AnsiballZ_ping.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<test-switch> (0, b'\r\nLine has invalid autocommand "/bin/sh -c \'chmod u+x \'"\'"\'Line has invalid autocommand "/bin/sh -c \'"\'"\'"\'"\'"\'"\'"\'"\'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c \'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'echo ~**** && sleep 0\'"\'"\'"\'"\'"\'"\'"\'"', b'')
<test-switch> ESTABLISH SSH CONNECTION FOR USER: ****
<test-switch> SSH: EXEC sshpass -d10 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="****"' -o ConnectTimeout=30 -o 'ControlPath="/root/.ansible/cp/e7f6d09650"' -tt test-switch '/bin/sh -c '"'"'/usr/bin/python '"'"'"'"'"'"'"'"'Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"/.ansible/tmp `"&& mkdir "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'echo ~**** && sleep 0'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"'"/.ansible/tmp/a"/AnsiballZ_ping.py'"'"'"'"'"'"'"'"' && sleep 0'"'"''
<test-switch> (0, b'\r\nLine has invalid autocommand "/bin/sh -c \'/usr/bin/python \'"\'"\'Line has invalid autocommand "/bin/sh -c \'"\'"\'"\'"\'"\'"\'"\'"\'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c \'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'"\'echo ~**** && sleep 0\'"\'"\'"\'"\'"', b'Shared connection to test-switch closed.\r\n')
[WARNING]: Platform unknown on host test-switch is using the discovered Python interpreter at /usr/bin/python, but future installation of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-core/2.13/reference_appendices/interpreter_discovery.html for more information.
test-switch | FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"module_stderr": "Shared connection to test-switch closed.\r\n",
"module_stdout": "\r\nLine has invalid autocommand \"/bin/sh -c '/usr/bin/python '\"'\"'Line has invalid autocommand \"/bin/sh -c '\"'\"'\"'\"'\"'\"'\"'\"'( umask 77 && mkdir -p \"` echo Line has invalid autocommand \"/bin/sh -c '\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'\"'echo ~**** && sleep 0'\"'\"'\"'\"'\"",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 0
}
user@server:~$