LOGBOOK

HELP

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.

Nesting of a playbook: the file is a list; each list item is a play object with name, hosts and tasks; tasks holds a list; each item is a task object with name and a module key whose value is an object of module arguments

* 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:

From Quiz: ITIA / Ansible Inventory, Configuration and Playbooks | Updated: Oct 30, 2026