/ansible-example

Example of ansible structure with inventories, variables and configuration

MIT LicenseMIT

Introduction

These files are just an example of a scalable Ansible structure. This structure of inventories, roles and variables is the most flexible one you can possibly do.

Besides, this structure respects the Ansible best-practices.

Structure

Here is the file structure you can find:

- inventories: this folder contains the different environment you can have (development, staging, production, etc...)
- roles: this folder contains all the roles that are applicable for the environments
- ansible.cfg: this file overrides the default Ansible configuration with certain custom values
- site.yml: this is the main playbook file
- common.yml: this playbook contains common roles that can be safely applied to all hosts
- database.yml: this playbook contains tasks used only for database servers
- webserver.yml: this playbook contains tasks used only for Web servers

If you take a look at the Ansible best practices, you will see that other folders can also be present if necessary.

Resources

Here are some useful resources you might want to check: