include
include module
Include and execute tasks from external task files. This allows you to organize and reuse task definitions across playbooks.
Examples
- name: Include common setup tasks
include_tasks: common/setup.yml
- name: Include tasks with variables
include_tasks: database/install.yml
vars:
db_version: "13"
- name: Conditionally include tasks
include_tasks: ssl/configure.yml
when: enable_ssl | bool
- name: Import tasks (static inclusion)
import_tasks: handlers/restart.yml
Note: include_tasks is dynamic (evaluated at runtime), while import_tasks is static (evaluated at parse time). This module also handles import_playbook and include directives.
Module Capabilities
- Has Revert: false
- Provides Variables: None
Inputs
No input parameters.
Outputs
No outputs.