could not SSH to Cisco using CentOS

218 views
Skip to first unread message

Edvinas K

unread,
Jul 6, 2017, 1:11:24 PM7/6/17
to Ansible Project
Hello,

installed linux (CENTOS) and trying to run an ansible test ping.

straight from linux box ssh ci...@172.1.1.2 works.

but the "ansible -m ping all" doesnt.

Maybe it's clear where could be a problem from this output:

[osboxes@osboxes ~]$ ansible -m ping servers -vvv

 
Using /etc/ansible/ansible.cfg as config file
META
: ran handlers
Using module file /usr/lib/python2.7/site-packages/ansible/modules/system/ping.py
<172.1.1.2> ESTABLISH SSH CONNECTION FOR USER: cisco
<172.1.1.2> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=cisco -o ConnectTimeout=10 -o ControlPath=/home/osboxes/.ansible/cp/1ed8487ad4 172.1.1.2 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<172.1.1.2> (0, '\r\nLine has invalid autocommand "/bin/sh -c \'echo ~ && sleep 0\'"', '')
<172.1.1.2> ESTABLISH SSH CONNECTION FOR USER: cisco
<172.1.1.2> SSH: EXEC sshpass -d12 ssh -C -o ControlMaster=auto -o ControlPersist=60s -o User=cisco -o ConnectTimeout=10 -o ControlPath=/home/osboxes/.ansible/cp/1ed8487ad4 172.1.1.2 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'echo ~ && sleep 0'"'"'"'"'"'"'"'"'"/.ansible/tmp/ansible-tmp-1499178341.35-260752414357590 `" && echo ansible-tmp-1499178341.35-260752414357590="` echo Line has invalid autocommand "/bin/sh -c '"'"'"'"'"'"'"'"'echo ~ && sleep 0'"'"'"'"'"'"'"'"'"/.ansible/tmp/ansible-tmp-1499178341.35-260752414357590 `" ) && sleep 0'"'"''
<172.1.1.2> (0, '\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/ansible-tmp-1499178341.35-260752414357590 `" && echo ansible-tmp-1499178341.35-260752414357590="` echo Line has invalid autocomma"', 'muxclient: master hello exchange failed\r\n')
<172.1.1.2> PUT /tmp/tmpacZGSy TO "` echo Line has invalid autocomma"/ping.py
<172.1.1.2> SSH: EXEC sshpass -d12 sftp -o BatchMode=no -b - -C -o ControlMaster=auto -o ControlPersist=60s -o User=cisco -o ConnectTimeout=10 -o ControlPath=/home/osboxes/.ansible/cp/1ed8487ad4 '[172.1.1.2]'
<172.1.1.2> (255, '', 'Connection closed\r\n')
172.1.1.2 | UNREACHABLE! => {
 
"changed": false,
 
"msg": "Failed to connect to the host via ssh: Connection closed\r\n",
 
"unreachable": true


Thanks for any suggestion, i cant think of something else..

Kai Stian Olstad

unread,
Jul 6, 2017, 1:21:06 PM7/6/17
to ansible...@googlegroups.com
On 06. juli 2017 17:56, Edvinas K wrote:
> installed linux (CENTOS) and trying to run an ansible test ping.
>
> straight from linux box ssh ci...@172.1.1.2 works.
>
> but the *"ansible -m ping all"* doesnt.
Ansible ping is a task that copies a python file to the remote an
execute the file. Cisco doesn't have Python and is not supported.

You need to use the ios_ modules that use the command line remotely from
the Ansible control machine.

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages