ansible / ansible.builtin / v2.15.2 / module / import_tasks Import a task list | "added in version" 2.4 of ansible.builtin" Authors: Ansible Core Team (@ansible)ansible.builtin.import_tasks (v2.15.2) — module
pip
Install with pip install ansible-core==2.15.2
Imports a list of tasks to be added to the current playbook for subsequent execution.
- hosts: all tasks: - ansible.builtin.debug: msg: task1 - name: Include task list in play ansible.builtin.import_tasks: file: stuff.yaml - ansible.builtin.debug: msg: task10
- hosts: all tasks: - ansible.builtin.debug: msg: task1 - name: Apply conditional to all imported tasks ansible.builtin.import_tasks: stuff.yaml when: hostvar is defined
file: description: - Specifies the name of the file that lists tasks to add to the current playbook. type: str version_added: '2.7' version_added_collection: ansible.builtin free-form: description: - 'Specifies the name of the imported file directly without any other option C(- import_tasks: file.yml). ' - Most keywords, including loops and conditionals, only apply to the imported tasks, not to this statement itself. - If you need any of those to apply, use M(ansible.builtin.include_tasks) instead.