cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1588
Views
0
Helpful
4
Replies

ansible -m ping all at ubuntu

interfacedy
Spotlight
Spotlight

Hi I have a question that is in my mind for a little long time. ansible/Ubuntu is intalled at vmware workstation. The Ubuntu can ping switches 192.168.10.10 without any issue. But before using command "ansible -m ping all" to ping the switch at the Ubuntu, we need to use the below commands to send key to switch 192.168.10.10. Looks like the ping has different path or machenism. but do not know how it work. Anyone can explain a little? Thank you

 

ssh-keygen -t rsa

ssh-copy-id 192.168.10.10

4 Replies 4

Hi

 Something doesn´t make sense.  The command  "ssh-keygen -t rsa"  ssh-copy-id 192.168.10.10 is used to access the swtich, or any device using SSH protocol. 

"ansible -m ping all" in the other hand, is just an attempt to ping a bunch of devices on the network. They dont should have relationship.

 

 

interfacedy
Spotlight
Spotlight

Thanks Flavio for your reply! I have the same exact question as you. It looks like it does not make sense. However both really have some relationship. People use it for ping to remote device from ansible/ubuntu successfully. It cannot work without it. Thats why i posted the question here. also below is example link:

https://www.youtube.com/watch?v=v-VEQddYw34

Hi

I got it.  The reason is as follow. Actually, this is not a ping just like we are used to use in network. This is a small scritp that actually access the remote host and run a validation and get  a responde. That´s why you need to use the Key gen before.

 

Features of the Ansible ping Module

The ping module is quite simple, and the following is a list of the features provided by this module:

Not an ICMP ping; rather, it is a small module that requires a valid Python environment on remote hosts.
Windows remote hosts should use the win_ping module instead.
Provides a net_ping module for network devices.
Accepts only a single parameter to raise an exception.
Used by default when calling the ansible command in the /usr/bin/ansible directory to verify login permissions and a valid Python environment.
Returns the string ‘pong’ on success.

interfacedy
Spotlight
Spotlight

Great! Very good explanation!

One more question, the command "ssh-copy-id 192.168.10.10" above is to send the key to server, if this is case, the below command has the same function? 

ip ssh pubkey-chain

username xxxx

key-string

xyxyxyxyxyxyyx.........(public key)

exit

eixt