invalid autocommand \"/bin/sh -c '/usr/bin/python '\"'\"'\"`

Hello,

I’m having issues with my new Ansible install.

Here’s the version i installed:

`

[root@srv-lx-shibb-idp test-project]# ansible --version
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
[root@srv-lx-shibb-idp test-project]#

`

I created an inventory file to play with:

`

[root@srv-lx-shibb-idp test-project]# pwd
/home/dadiaspe/test-project
[root@srv-lx-shibb-idp test-project]# ls -ltr
total 4
-rw-r–r–. 1 root root 202 May 20 22:55 inventory.txt
[root@srv-lx-shibb-idp test-project]# cat inventory.txt
vcme ansible_host=10.201.238.147 ansible_connection=ssh ansible_user=admin ansible_ssh_pass=cocis
[root@srv-lx-shibb-idp test-project]#

`

When trying to run the following command, i get an error:

`

[root@srv-lx-shibb-idp test-project]# ansible vcme -m ping -i inventory.txt
[WARNING]: sftp transfer mechanism failed on [10.201.238.147]. Use ANSIBLE_DEBUG=1 to see detailed information

[WARNING]: scp transfer mechanism failed on [10.201.238.147]. Use ANSIBLE_DEBUG=1 to see detailed information

vcme | FAILED! => {
“changed”: false,
“module_stderr”: “Shared connection to 10.201.238.147 closed.\r\n”,
“module_stdout”: “\r\n\r\n\r\nLine has invalid autocommand "/bin/sh -c ‘/usr/bin/python ‘"’"’"echo /home/dadiaspe/test-project/ansible-tmp-1558419011.91-227396699620382" ) && sle"/ping.py’"‘"’; rm -rf ""echo /home/dadiaspe/test-project/ansible-tmp-1558419011.91-227396699620382" ) && sle"/" > /dev/null 2>&1"”,
“msg”: “MODULE FAILURE”,
“rc”: 0
}

`

Running the command again, with verbosity:

`

[root@srv-lx-shibb-idp test-project]# ansible --version
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
[root@srv-lx-shibb-idp test-project]# ansible vcme -m ping -i inventory.txt -vvv
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u’/root/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Apr 9 2019, 14:30:50) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
Using /etc/ansible/ansible.cfg as config file
Parsed /home/dadiaspe/test-project/inventory.txt inventory source with ini plugin
META: ran handlers
Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/ping.py
<10.201.238.147> ESTABLISH SSH CONNECTION FOR USER: admin
<10.201.238.147> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/63ecd92fc7 10.201.238.147 ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” && echo ansible-tmp-1558419302.35-207412972030875=“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sleep 0’“'”‘’
<10.201.238.147> (0, ‘\r\n\r\n\r\nLine has invalid autocommand “/bin/sh -c '( umask 77 && mkdir -p “echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” && echo ansible-tmp-1558419302.35-207412972030875=“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle”’, ‘’)
<10.201.238.147> PUT /tmp/tmpXzFpSd TO “echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle"/ping.py
<10.201.238.147> SSH: EXEC sshpass -d11 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/63ecd92fc7 ‘[10.201.238.147]’
[WARNING]: sftp transfer mechanism failed on [10.201.238.147]. Use ANSIBLE_DEBUG=1 to see detailed information

<10.201.238.147> SSH: EXEC sshpass -d11 scp -C -o ControlMaster=auto -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/63ecd92fc7 /tmp/tmpXzFpSd ‘[10.201.238.147]:’“'”‘“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle"/ping.py’“'”‘’
[WARNING]: scp transfer mechanism failed on [10.201.238.147]. Use ANSIBLE_DEBUG=1 to see detailed information

<10.201.238.147> ESTABLISH SSH CONNECTION FOR USER: admin
<10.201.238.147> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/63ecd92fc7 10.201.238.147 ‘dd of=“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle"/ping.py bs=65536’
<10.201.238.147> (0, ‘\r\n\r\n\r\nLine has invalid autocommand “dd of=“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle”/ping.py bs=65536"’, ‘’)
<10.201.238.147> (0, ‘\r\n\r\n\r\nLine has invalid autocommand “dd of=“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle”/ping.py bs=65536"’, ‘’)
<10.201.238.147> ESTABLISH SSH CONNECTION FOR USER: admin
<10.201.238.147> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/63ecd92fc7 10.201.238.147 ‘/bin/sh -c ‘"’“'chmod u+x '”’“'”‘"’“'”‘"’“'“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle”/‘"’“'”‘"’“'”‘"’“’ '”‘"’“'”‘"’“'”‘"’“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle"/ping.py’“'”‘"’“'”‘"’“'”’ && sleep 0’“'”‘’
<10.201.238.147> (0, ‘\r\n\r\n\r\nLine has invalid autocommand “/bin/sh -c 'chmod u+x '”'“'“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle”/'“'”' '“'”'“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle"/ping.py'“'”' && sleep 0'"’, ‘’)
<10.201.238.147> ESTABLISH SSH CONNECTION FOR USER: admin
<10.201.238.147> SSH: EXEC sshpass -d11 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=admin -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/63ecd92fc7 -tt 10.201.238.147 ‘/bin/sh -c ‘"’"’/usr/bin/python ‘"’“'”‘"’“'”‘"’“'“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle”/ping.py’“'”‘"’“'”‘"’“'”‘; rm -rf ““echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle”/" > /dev/null 2>&1 && sleep 0’“'”‘’
<10.201.238.147> (0, ‘\r\n\r\n\r\nLine has invalid autocommand “/bin/sh -c '/usr/bin/python '”'“'“echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle”/ping.py'“'”'; rm -rf ““echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875” ) && sle”/" > /dev/null 2>&1"’, ‘Shared connection to 10.201.238.147 closed.\r\n’)
vcme | FAILED! => {
“changed”: false,
“module_stderr”: “Shared connection to 10.201.238.147 closed.\r\n”,
“module_stdout”: “\r\n\r\n\r\nLine has invalid autocommand "/bin/sh -c ‘/usr/bin/python ‘"’"’"echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875" ) && sle"/ping.py’"‘"’; rm -rf ""echo /home/dadiaspe/test-project/ansible-tmp-1558419302.35-207412972030875" ) && sle"/" > /dev/null 2>&1"”,
“msg”: “MODULE FAILURE”,
“rc”: 0
}
[root@srv-lx-shibb-idp test-project]#

`

I haven’t changed anything under /etc/ansible/ansible.cfg

I’m fairly new with Ansible, so i might be missing something but not sure what.

Thanks in advance

What kind of host is 10.201.238.147

Can you SSH into it manually?