March 2019
Intermediate to advanced
412 pages
9h 49m
English
Task files are YAML files that define one or more tasks. These tasks are not directly tied to any particular play or playbook; they exist purely as a list of tasks. These files can be referenced by playbooks or other task files by way of the include operator. This operator takes a path to a task file, and as we learned in Chapter 1, The System Architecture and Design of Ansible, the path can be relative to the file referencing it.
To demonstrate how to use the include operator to include tasks, let's create a simple play that includes a task file with some debug tasks within it. First, let's write our playbook file, and we'll call it includer.yaml:
--- - name: task inclusion hosts: localhost gather_facts: false tasks: - name: ...
Read now
Unlock full access