Quiz Entry - updated: 2026.10.30
In YAML data-structure terms, what are a playbook, a play, the tasks key and a task?
A playbook is a list of plays. A play is an object with at least name, hosts and tasks. The value of tasks is a list of tasks. A task is an object with at least a name and one module.
* List of plays, play is an object, tasks is a list, task is an object: the pattern repeats one level down. *
- name: Configure important user consistently # play = list item, an object
hosts: servera.lab.example.com
tasks: # key whose value is a list
- name: newbie exists with UID 4000 # task = list item, an object
user: # module key ...
name: newbie # ... whose value is an object of arguments
uid: 4000
state: present
Knowing the data types is what lets you read and debug any playbook:
- A leading
-at the outermost level = a new play. - Lines without a dash under it = keys of that play object.
- Under
tasks:, each-= a new task. - The module key (
user:) holds an object of arguments.
Strictly, name is optional in Ansible, but always set it: it is what the output prints for each play and task.
Go deeper:
Ansible playbooks (official docs) — playbook syntax and execution, with annotated examples.
What is Ansible, Ansible Playbook explained (TechWorld with Nana) — visual walk-through of plays, tasks and modules.