The include action was too confusing, dealing with both plays and tasks, being both dynamic and static. This module will be removed in version 2.8. As alternatives use include_tasks, import_plays, import_tasks.
static
directive (new in 2.1) to bypass autodetection.parameter | required | default | choices | comments |
---|---|---|---|---|
free-form | no | This module allows you to specify the name of the file directly w/o any other options. |
# include a play after another play - hosts: localhost tasks: - debug: msg: "play1" - include: otherplays.yml # include task list in play - hosts: all tasks: - debug: msg: task1 - include: stuff.yml - debug: msg: task10 # dyanmic include task list in play - hosts: all tasks: - debug: msg: task1 - include: "{{ hostvar }}.yml" static: no when: hostvar is defined
Note
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/include_module.html