Quiz Entry - updated: 2026.10.22
How do task, module, play and playbook relate to each other?
A playbook (YAML file) contains one or more plays; a play applies an ordered list of tasks to a set of hosts; each task calls one module with arguments.
* A playbook holds plays, a play applies ordered tasks to an inventory group, and each task calls one module. *
From small to large:
- Module: a small piece of code (Python, PowerShell, or another language) that does one specific job, such as installing a package or managing a file. Ansible ships with hundreds of them.
- Task: one call of a module with specific arguments, for example "module
package, namehttpd, statepresent". - Play: maps a group of hosts to a list of tasks and runs those tasks in order. It puts those hosts into a defined state.
- Playbook: a YAML text file that contains one or more plays.
Instead of writing complex scripts, you write plays. The playbook is the file that defines the actions Ansible performs on managed hosts. The inventory only says which hosts exist; a "manifest" is Puppet's term, not Ansible's.
Go deeper:
Ansible concepts (official docs) — defines plays, tasks, modules, plugins and playbooks in one page.
Ansible playbooks (official docs) — how plays map hosts to ordered task lists, with annotated examples.