Write a playbook
Create a playbook that pings your hosts and prints a "Hello world" message.
About this task
Ansible uses the YAML syntax. YAML is a human-readable language that enables you to create playbooks without having to learn a complicated coding language.
Procedure
Results
Ansible returns the following output:
PLAY [My first play] ********************************************************
TASK [Gathering Facts] ******************************************************
ok: [192.0.2.50]
ok: [192.0.2.51]
ok: [192.0.2.52]
TASK [Ping my hosts] ********************************************************
ok: [192.0.2.50]
ok: [192.0.2.51]
ok: [192.0.2.52]
TASK [Print message] ********************************************************
ok: [192.0.2.50] => {
"msg": "Hello world"
}
ok: [192.0.2.51] => {
"msg": "Hello world"
}
ok: [192.0.2.52] => {
"msg": "Hello world"
}
PLAY RECAP ******************************************************************
192.0.2.50: ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
192.0.2.51: ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
192.0.2.52: ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0