Plays
Cheat sheet · https://pcornel.dk/topic.php?topic=5398
Answer
A play binds a host pattern to variables, roles/tasks, privilege and execution behavior, forming a host-scoped unit inside a playbook.
Remember
- Play exists ≠ host participates; host pattern plus limit determines membership.
- Play-level variable ≠ final value; other precedence sources can override it.
- Role listed ≠ every role task runs; tags/conditionals/includes can alter execution.
- Play success on one host ≠ all hosts succeeded; results are host-specific.
First checks
ansible-playbook site.yml --list-hosts— hosts per play- hosts:, become:, gather_facts: per play — settings
- Play-level vars — scope
Verify in this order
play → hosts → tasks
Where it usually breaks
A play executing proves its selected host/task graph ran under Ansible semantics; it does not prove excluded hosts or external service dependencies.
Inventory/vars → play/task selection → connection/become → module request → module result → target object read-back → handler/service effective state → workload verification.
Plays Ansible boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Inputs / selection | Correct inventory, hosts, variables/facts and content are explicit | Wrong scope, stale facts, hidden precedence or content-version drift |
| Execution | Connection, privilege, module/task context and ordering match intent | Unreachable, wrong execution host, privilege/plugin failure or misleading skip/change state |
| Result semantics | Per-host/item results are preserved and interpreted correctly | Aggregate recap hides partial/skipped/handled failures |
| Target proof | Resource/workload read-back and rerun confirm convergence | Green Ansible status treated as end-to-end acceptance |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5398