# could not SSH to Cisco using CentOS

**URL:** <https://forum.ansible.com/t/could-not-ssh-to-cisco-using-centos/24914>\
**Category:** Ansible Project\
**Created:** [July 6, 2017, 3:56pm UTC](https://forum.ansible.com/t/could-not-ssh-to-cisco-using-centos/24914 "2017-07-06T15:56:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edvinas](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/edvinas/32/5406_2.png) [@Edvinas](https://forum.ansible.com/u/Edvinas)\
**Post date:** [July 6, 2017, 3:56pm UTC](https://forum.ansible.com/t/could-not-ssh-to-cisco-using-centos/24914/1 "2017-07-06T15:56:04Z")

</div>

Hello,

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

straight from linux box ssh [cisco@172.1.1.2](mailto:cisco@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

`

```auto

```

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

```

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 6, 2017, 5:20pm UTC](https://forum.ansible.com/t/could-not-ssh-to-cisco-using-centos/24914/2 "2017-07-06T17:20:40Z")

</div>

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.
