LOGBOOK

HELP

Quiz Entry - updated: 2026.11.26

What exactly does "static" mean for an import and "dynamic" for an include?

An import is expanded while the playbook is parsed, so it behaves as if the tasks had been pasted in. An include is just one task until the run reaches it; only then is the file read and its tasks added.

Running a playbook has two phases: Ansible first parses the whole playbook into a list of plays and tasks, then executes that list host by host.

Parse phase: an import is read and replaced by its tasks. Run phase: an include stays one task until it is reached, then its when and loop are checked and only then is the file read and run

* Imports are resolved in phase 1, includes in phase 2. *

  • Import (static). During parsing, Ansible opens the imported file and puts its tasks in place of the import line. By the time execution starts, the import has disappeared: the play simply contains those tasks. Nothing that happens during the run can change what was imported.
  • Include (dynamic). During parsing, the include stays a single task. When execution reaches it, Ansible evaluates it like any other task (its when, its loop, its variables for this host), then reads the file and runs the tasks in it. So the result of earlier tasks can decide whether and how the file is included.

A good mental model: import = copy-paste before the run; include = a function call during the run.

Go deeper:

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