Reference:
user name geerlingguy is very famous in galaxy.ansible.com:
Ansible Roles
- It is a standard directory structure to abstract the functionality of Ansible playbooks.
- You can search and download some of the existing roles from Ansible Galaxy website ( https://galaxy.ansible.com/)
Ansible Roles Directory Structure
When you create or install an ansible galaxy role, then the following directories automatically get created and these directories have a special purpose (except for the templates and tests directory). All the pre-defined directories contain main.yml, if any of these directories get called then the execution of that directory is started from main.yml code only.
|
defaults: |
For default
variables values. |
|
files: |
files which
are referred to in the role. |
|
handler: |
Whenever
there is any notification is triggered when the handler's main.yml file gets
called which should have a definition of those notification services. |
|
meta: |
It stores
role's metadata like Authorname, version etc |
|
tasks: |
Contains the
definition of modules which are supposed to execute as a task. |
|
templates: |
It includes
the Jinja templates definition. |
|
tests: |
Contains test
cases for role |
|
vars: |
To define global variables for the roles. |