Create a directory called ansible-helloworld-playbook
mkdir ansible-helloworld-playbook
Create a file hosts
and add remote systems how want to manage. As ansible relies on ssh to connect the machines, you should make sure they are already accessible to you in ssh from your computer.
192.168.1.1
192.168.1.2
Test connection to your remote systems using the Ansible ping module.
ansible all -m ping -k
In case of success it should return something like that
192.168.1.1| SUCCESS => {
"changed": false,
"ping": "pong"
}
192.168.1.2| SUCCESS => {
"changed": false,
"ping": "pong"
}
In case of error it should return
192.168.1.1| UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh.",
"unreachable": true
}
Test sudo access with
ansible all -m ping -k -b