The playbook structure
In Chapter 1, Installing and Running Ansible, the playbooks we ran were as basic as possible. They have been in a single file, accompanied by a host inventory file, and, if required, a template file. Then, in Chapter 2, Exploring Ansible Galaxy, we extended our playbook files to include roles rather than putting all our tasks, handlers, and variables into one file.
As you can see from the following layout, there are several folders and files:
Figure 4.1 – The folder structure we will use for our playbook
While there is a copy of the structure in the repository, let’s work on creating the structure and discuss each item as we create it. The first folder we need to create is our top-level folder. This is the folder that will contain our playbook folders and files:
$ mkdir Chapter04 $ cd Chapter04
The next folder we are going to create is one called group_vars
. This will contain the variable files used in our playbook...