Note
This module is part of ansible-core and included in all Ansible installations. In most cases, you can use the short module name include even without specifying the collections: keyword. However, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 0.6: of ansible.builtin
static directive (which was added in Ansible 2.1) to bypass autodetection.| Parameter | Choices/Defaults | Comments |
|---|---|---|
| free-form string | This module allows you to specify the name of the file directly without any other options. |
Note
See also
The official documentation on the ansible.builtin.import_playbook module.
The official documentation on the ansible.builtin.import_role module.
The official documentation on the ansible.builtin.import_tasks module.
The official documentation on the ansible.builtin.include_role module.
The official documentation on the ansible.builtin.include_tasks module.
More information related to including and importing playbooks, roles and tasks.
- hosts: localhost
tasks:
- debug:
msg: play1
- name: Include a play after another play
include: otherplays.yaml
- hosts: all
tasks:
- debug:
msg: task1
- name: Include task list in play
include: stuff.yaml
- debug:
msg: task10
- hosts: all
tasks:
- debug:
msg: task1
- name: Include task list in play only if the condition is true
include: "{{ hostvar }}.yaml"
static: no
when: hostvar is defined
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/include_module.html