# Ansible 1.9.1 SSH Error from ping module to Junos

**URL:** <https://forum.ansible.com/t/ansible-1-9-1-ssh-error-from-ping-module-to-junos/18334>\
**Category:** Ansible Project\
**Created:** [May 28, 2015, 4:56pm UTC](https://forum.ansible.com/t/ansible-1-9-1-ssh-error-from-ping-module-to-junos/18334 "2015-05-28T16:56:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Mcpherson](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Matt\_Mcpherson](https://forum.ansible.com/u/Matt_Mcpherson)\
**Post date:** [May 28, 2015, 4:56pm UTC](https://forum.ansible.com/t/ansible-1-9-1-ssh-error-from-ping-module-to-junos/18334/1 "2015-05-28T16:56:11Z")

</div>

Good afternoon all, my apologies for posting but I have been stopped at this point with no result for a few days. I have installed Ansible 1.9.1 and , I believe, all required dependencies on CentOS 7 , I am looking to use Ansible to manage Junos equpment and installed the Juniper.junos module along with its dependencies.

When I try to connect to my hosts via ansible ping module I am having an SSH issue. From my Ansible server I can directly SSH to the Junos devices that I want to manage using the public rsa key loaded into my Junos config for login “matt”. But when I run the ping module I am unable to complete the test. Here is my output…

[root@localhost /]# ansible all -m ping -vvvv  
\<10.71.16.5\> ESTABLISH CONNECTION FOR USER: matt  
\<10.71.16.5\> REMOTE\_MODULE ping  
\<10.71.16.5\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/root/.ansible/cp/ansible-ssh-%h-%p-%r” -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=matt -o ConnectTimeout=10 10.71.16.5 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1432831825.76-143908795390292 && echo $HOME/.ansible/tmp/ansible-tmp-1432831825.76-143908795390292’  
\<10.71.16.5\> PUT /tmp/tmpp9HeF0 TO error: unknown command: /bin/sh/ping  
\<10.71.16.5\> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/root/.ansible/cp/ansible-ssh-%h-%p-%r” -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=matt -o ConnectTimeout=10 10.71.16.5 /bin/sh -c ‘LANG=C LC\_CTYPE=C /usr/bin/python error: unknown command: /bin/sh/ping’  
10.71.16.5 | FAILED \>\> {  
“failed”: true,  
“msg”: “\r\nerror: unknown command: /bin/sh\r\nOpenSSH\_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013\r\ndebug1: Reading configuration data /etc/ssh/ssh\_config\r\ndebug1: /etc/ssh/ssh\_config line 56: Applying options for \*\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O\_NONBLOCK\r\ndebug2: mux\_client\_hello\_exchange: master version 4\r\ndebug3: mux\_client\_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux\_client\_request\_session: entering\r\ndebug3: mux\_client\_request\_alive: entering\r\ndebug3: mux\_client\_request\_alive: done pid = 2464\r\ndebug3: mux\_client\_request\_session: session request sent\r\ndebug1: mux\_client\_request\_session: master session id: 2\r\ndebug3: mux\_client\_read\_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 10.71.16.5 closed.\r\n”,  
“parsed”: false  
}

I also tried ping as root to the Junos devices using the -u and -k options, again I can connect directly via SSH, but when I run “ping” or a playbook referencing “ping” then enter the password I also cannot connect.

Can someone help?

---

<div class="post-metadata">

**Author:** ![Matt\_Mcpherson](https://avatars.discourse-cdn.com/v4/letter/m/3da27b/32.png) [@Matt\_Mcpherson](https://forum.ansible.com/u/Matt_Mcpherson)\
**Post date:** [May 28, 2015, 7:34pm UTC](https://forum.ansible.com/t/ansible-1-9-1-ssh-error-from-ping-module-to-junos/18334/2 "2015-05-28T19:34:08Z")

</div>

So, after continuing to look at this it appears that SSH / paramiko are working but the ping module is failing to load the python interpreter. There are symbolic links already created from /usr/bin/python —\> /usr/bin/python2.7 … I tried specifying the direct path to the hosts file

**10.71.16.2 ansible\_python\_interpreter=usr/bin/python2.7**

This produced the following error (at least referencing the new location for python interpreter)

**10.71.16.2 | FAILED \>\> {**  
**“failed”: true,**  
**“msg”: “/usr/bin/python2.7: not found\n”,**  
**“parsed”: false**  
**}**

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [May 28, 2015, 10:10pm UTC](https://forum.ansible.com/t/ansible-1-9-1-ssh-error-from-ping-module-to-junos/18334/3 "2015-05-28T22:10:07Z")

</div>

the ping module uses the python on the target machine (it is not a  
network ping), do the junos switches have python on them?

---

<div class="post-metadata">

**Author:** ![Prasanna\_Siriki](https://avatars.discourse-cdn.com/v4/letter/p/ebca7d/32.png) [@Prasanna\_Siriki](https://forum.ansible.com/u/Prasanna_Siriki)\
**Post date:** [June 12, 2015, 5:24pm UTC](https://forum.ansible.com/t/ansible-1-9-1-ssh-error-from-ping-module-to-junos/18334/4 "2015-06-12T17:24:04Z")

</div>

Hi Matt,

in the /etc/ansible/hosts  
host1 ansible\_connection=local ansible\_ssh\_host=10.71.16.5

hope this may help you

Regards,  
siriki

---

<div class="post-metadata">

**Author:** ![Mark\_Reyes](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@Mark\_Reyes](https://forum.ansible.com/u/Mark_Reyes)\
**Post date:** [November 16, 2017, 5:30am UTC](https://forum.ansible.com/t/ansible-1-9-1-ssh-error-from-ping-module-to-junos/18334/5 "2017-11-16T05:30:25Z")

</div>

This got it for me!  
Ansible threw out so many weird errors, once local connection was specified… they all went away.
