3025 shaares
Ansible offers two ways to reuse files and roles in a playbook: dynamic and static.
-
For reuse, add an include_* task in the tasks section of a play:
- include_role
- include_tasks
- include_vars
-
For static reuse, add an import_* task in the tasks section of a play:
- import_role
- import_tasks
Task include and import statements can be used at arbitrary depth.
You can still use the bare roles keyword at the play level to incorporate a role in a playbook statically. However, the bare include keyword, once used for both task files and playbook-level includes, is now deprecated.