Ansible Tools: The Ping Module

Ansible Ping

What Ansible Ping does

Ansible ping is a great way to test if ansible can connect to remote hosts and execute commands. This is different from a 'network ping', in that it not only tests network connectivity, but it tests SSH connectivity and also checks to make sure Python is installed on the remote hosts. This is a simple module to take advantage of so let's get into it.

Inventory file

We have a basic inventory file. Set yours up to match your environment.

 File
[servers]
node1 ansible_host=10.1.1.50
node2 ansible_host=10.1.1.51
node3 ansible_host=10.1.1.52

Running Ansible Ping

Here is the command I used to run Ansible ping:

 Terminal
ansible -i hosts servers -m ping