LOGBOOK

HELP

Quiz Entry - updated: 2026.11.26

Why is there an import_playbook but no include_playbook?

Playbooks can only be reused statically. Ansible must know every play before it starts, so whole playbooks can only be imported, never included at run time.

An include is a task that runs when the play reaches it. But a playbook is a list of plays, and a play is the thing that contains tasks: there is no running play in which an "include this playbook" task could sit. So import_playbook is the only way to pull in playbooks, and it works at parse time.

You can still pick the file with a variable, as long as the value is known at parse time: from --extra-vars on the command line or from the vars keyword on the import. A host or group variable from the inventory doesn't work, because those belong to individual hosts and are not used while the playbook is being parsed.

Go deeper:

From Quiz: ITIA / Ansible: Complex Playbooks with Imports and Includes | Updated: Nov 26, 2026