LOGBOOK

HELP

Quiz Entry - updated: 2026.12.01

You put when: on an include_tasks. What does the condition control?

Only the include itself: the condition is checked once and decides whether the file is included at all. If it is, every task in the file runs normally.

The include is a single task at run time, so its when: is evaluated once per host, when the include is reached:

  • false → the file is not loaded, and none of its tasks run on that host;
  • true → the file is loaded, and its tasks run without inheriting the condition.

That is the opposite of an import, where the condition is copied onto every task and re-checked for each. Changes made by the included tasks can't cause their own skips, because the condition is already behind them.

Condition on Checked Applies to
import_tasks once per imported task every task in the file
include_tasks once, at the include the include task only

Go deeper:

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