I’m reading the inventory document but can’t follow this example:
Suppose you have just static IPs and want to set up some aliases that live in your host file, or you are connecting through tunnels. You can also describe hosts like this:
jumper ansible_port=5555 ansible_host=192.168.1.50
Here is my /etc/ansible/hosts file:
vm1 ansible_host=localhost ansible_connection=local
vm2 ansible_host=192.168.104.102
When I tried to ping every host, I got this error message for vm2:
vagrant@vm1:~$ ansible all -m ping
vm2 | FAILED => SSH Error: ssh: Could not resolve hostname vm2: Name or service not known
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
vm1 | success >> {
“changed”: false,
“ping”: “pong”
}
How can I set an alias for static IP 192.168.104.102 ?