Organizing Ansible automation content
In Chapter 4, Exploring Collaboration in Automation Development, you learned about version control systems (VCSs) and source control management (SCM) and how to use GitHub services to store Ansible artifacts.
It is the best practice to create project-specific directories (that is, repositories) to keep all related items at a single location, such as project-specific ansible.cfg
files, playbooks, roles, collections, or libraries. If there are external roles or collections dependencies, then mention the details inside the requirements.yaml
(or requirements.yml
) file.
Use the tree
command in Linux to list the directories and files recursively and understand the structure of the directory’s content. A sample project directory can be organized like so:
Figure 16.1 – Typical Ansible project directory
Your roles will be under the roles
directory, as shown in the following screenshot: