Quiz Entry - updated: 2026.10.30
How do you run a playbook, and how do you read its output?
Run ansible-playbook <file>.yml on the control node. The output shows a PLAY header, then a TASK header per task with one status line per host (ok, changed, failed...), and ends with a PLAY RECAP that counts the outcomes per host.
$ ansible-playbook webserver.yml
PLAY [play to setup web server] ***************************
TASK [Gathering Facts] ************************************
ok: [servera.lab.example.com]
TASK [latest httpd version installed] *********************
changed: [servera.lab.example.com]
PLAY RECAP ************************************************
servera.lab.example.com : ok=2 changed=1 unreachable=0 failed=0
How to read it:
- PLAY [name] and TASK [name] print the
name:values you wrote, which is why naming tasks well pays off. - Gathering Facts is an automatic first task: Ansible collects information about each host (OS, IPs, interpreter) before your tasks run.
- ok = already in the desired state, nothing done. changed = Ansible modified something. failed = the task errored. unreachable = Ansible couldn't connect.
- PLAY RECAP is the summary per host. In the recap,
okcounts all successful tasks, including the changed ones: here 2 ok, of which 1 changed.
The task name "latest httpd version installed" uses state: latest, which upgrades when a newer version exists; present would only install if missing.
Go deeper:
ansible-playbook command reference (official docs) — options such as
--limit,--check,-v.Ansible playbooks: running playbooks (official docs) — what happens during a run.