As we have seen in the previous chapter, it is possible to use Ansible to automate simple tasks that you probably already perform daily.
Let's start by checking if a remote machine is reachable; in other words, let's start by pinging a machine. The simplest way to do this, is to run the following:
$ ansible all -i HOST, -m ping
Here, HOST
is an IP address, the Fully Qualified Domain Name (FQDN), or an alias of a machine where you have SSH access (you can use a Kernel-based Virtual Machine (KVM), as we have seen in the previous chapter).
Tip
After the "HOST,
" the comma is mandatory, because otherwise it would not be seen as a list, but as a string.
In this case, we have performed it against a virtual machine on our system:
$ ansible all -i test01.fale.io, -m ping
You should receive something like this as a result:
test01.fale.io | SUCCESS => {
"changed": false,
"ping": "pong"
}
Now, let's see what we did and why. Let's start from the Ansible help. To query it, we can...