As the playbook grows in size, it will eventually become obvious that many of the tasks and plays can be shared across different playbooks. The Ansible include statement is similar to many Linux configuration files that just tell the machine to extend the file the same way as if the file was directly written in. We can use an include statement for both playbooks and tasks. Here, we will look at a simple example of extending our task.
Let's assume that we want to show outputs for two different playbooks. We can make a separate YAML file called show_output.yml as an additional task:
--- - name: show output debug: var: output
Then, we can reuse this task in multiple playbooks, such as in chapter5_11_1.yml, which ...