Organization of the Repository

Let's learn about the folder structure of our repository and the steps involved in its organization.

We'll cover the following

Steps to organize repository

The organization of the repository includes a combination of necessary Ansible framework files and folders, as well as user-defined files and folders. Create a repository that scales, is easily navigated, and supports the Ansible framework. Build a folder structure that’s best suited to the reflects the environment being automated.

Build the structure using empty folders and empty placeholder files that suit the environment. Build a repository suitable for an enterprise campus environment consisting of Cisco Catalyst devices running IOS, and an enterprise data center consisting of Cisco Nexus devices running NX-OS. Remember there are many Ansible modules available from other vendors, if not running a Cisco network.

Important Note: Git will not track or provide version control for empty folders. When creating each folder in the repository, create an empty file called .gitignore. This ensures the folder structure ends up in the repository. If this file is not created and the folder is left empty, the folder will not end up in the repository until a file is present. Once files are added to these folders, the .gitignore file can be deleted.

Create the base folder structure with hosts, and a README.md file, so that the repository looks like the following:

    .
    |-- configuration
    |-- documentation
    |-- filter_plugins
    |-- group_vars
    |-- host_vars
    |-- playbooks
    |-- tasks
    |-- templates
    |-- README.md
     -- hosts

Get hands-on with 1400+ tech skills courses.