In this lab, you will learn how to confirm the connection between your ansible machine and hosts.
We will use the ping module for this purpose.
Estimated Time: 20 minutes
The ping module is used to verify connectivity between Ansible and its hosts.
The default syntax for using the ping module is:
ansible <Pattern> -m pingRun the following command to test the connection:
ansible webservers -m ping<IP 1> | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": false,
"ping": "pong"
}SUCCESS: Indicates that Ansible successfully connected to the hosts.changed: false: Confirms that no changes were made on the hosts.ping: "pong": Confirms connectivity between Ansible and the hosts.
Note: This is not an ICMP ping; it is a test of Ansible's ability to connect to the hosts.
You have successfully verified connectivity using the ping module!