Very first time Network Engineer user - ping module needs to connect with SSH to work?

50 views
Skip to first unread message

Greg Focaccio

unread,
Oct 19, 2018, 8:49:19 AM10/19/18
to Ansible Project
Hi All,

First time getting into any kind of automation -starting with Ansible.

Odd results for me.  What is going on?

Thanks,
Greg

05:41root@xfrr3 /etc/ansible ? ansible f1 --module-name=ping
172.16.0.1 | UNREACHABLE! => {
   "changed": false,                                                                        
   "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).\r
\n",                                                                                         
   "unreachable": true                                                                      
}                                                                                            
05:41root@xfrr3 /etc/ansible ? ping 172.16.0.1
PING 172.16.0.1 (172.16.0.1) 56(84) bytes of data.
64 bytes from 172.16.0.1: icmp_seq=1 ttl=255 time=0.410 ms
64 bytes from 172.16.0.1: icmp_seq=2 ttl=255 time=0.508 ms
^C
--- 172.16.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1009ms
rtt min/avg/max/mdev = 0.410/0.459/0.508/0.049 ms
05:41root@xfrr3 /etc/ansible ?



Jonathan Lozada De La Matta

unread,
Oct 19, 2018, 8:51:11 AM10/19/18
to ansible...@googlegroups.com
does the other end have your public keys for the user you are running ansible? or the ssh keys loaded??

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/05574f2c-3e50-4cb6-867c-b1e819132642%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Jonathan lozada de la matta

AUTOMATION PRACTICE



 

Uwe Sauter

unread,
Oct 19, 2018, 8:54:05 AM10/19/18
to ansible...@googlegroups.com
The ping module is not the classical ping command but an Ansible module that will connetc to the remote host via SSH and send back
a "pong" if that succeeds. See the docs.


If you want to use the classical ping command you need to use the "command" or "shell" module to call that from Ansible; but
beware that this task needs to be run on localhost to reflect what you would usually do on the command line.


Am 19.10.18 um 14:49 schrieb Greg Focaccio:
> Hi All,
>
> First time getting into any kind of automation -starting with Ansible.
>
> Odd results for me.  What is going on?
>
> Thanks,
> Greg
>
> |
> 05:41root@xfrr3/etc/ansible ?ansible f1 --module-name=ping
> |172.16.0.1 | UNREACHABLE! => {
>    "changed": false,                                                                        
>    "msg": "Failed to connect to the host via ssh: Permission denied (publickey,password).\r
> \n",                                                                                         
>    "unreachable": true                                                                     
> }                                                                                           
> 05:41root@xfrr3/etc/ansible ? ping 172.16.0.1
> PING 172.16.0.1 (172.16.0.1) 56(84) bytes of data.
> 64 bytes from 172.16.0.1: icmp_seq=1 ttl=255 time=0.410 ms
> 64 bytes from 172.16.0.1: icmp_seq=2 ttl=255 time=0.508 ms
> ^C
> --- 172.16.0.1 ping statistics ---
> 2 packets transmitted, 2 received, 0% packet loss, time 1009ms
> rtt min/avg/max/mdev = 0.410/0.459/0.508/0.049 ms
> 05:41root@xfrr3/etc/ansible ?
>
>
>
> --
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com
> <mailto:ansible-proje...@googlegroups.com>.
> To post to this group, send email to ansible...@googlegroups.com <mailto:ansible...@googlegroups.com>.
> <https://groups.google.com/d/msgid/ansible-project/05574f2c-3e50-4cb6-867c-b1e819132642%40googlegroups.com?utm_medium=email&utm_source=footer>.

Kai Stian Olstad

unread,
Oct 19, 2018, 8:55:07 AM10/19/18
to ansible...@googlegroups.com
On 19.10.2018 14:49, Greg Focaccio wrote:
> First time getting into any kind of automation -starting with Ansible.
>
> Odd results for me. What is going on?

If you check the documentation[1] it clearly state the following.


ping - Try to connect to host, verify a usable python and return pong
on success
- This is NOT ICMP ping, this is just a trivial test module that
requires Python on the remote-node.

--
Kai Stian Olstad

Jonathan Lozada De La Matta

unread,
Oct 19, 2018, 8:55:29 AM10/19/18
to ansible...@googlegroups.com
oh ignore my comment I missed the networking part. 

To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/62a0ad82-d39b-3aeb-7ee7-3fd59acc6175%40gmail.com.

For more options, visit https://groups.google.com/d/optout.

joba...@redhat.com

unread,
Oct 19, 2018, 9:24:04 AM10/19/18
to Ansible Project
Hi,
Welcome to the Ansible Community

We have some Ansible Network getting started documentation which maybe a good place to start https://docs.ansible.com/ansible/latest/network/

Kind regards,
gundalow

Reply all
Reply to author
Forward
0 new messages