How to create Ansible roles

Ansible Role is set of directory structures and yml files

Roles help to organize set of tasks and group it

command (to create role):

Ansible-galaxy init /etc/ansible/roles/project1 –offline

now, project1 directory has 8 directories:
1.defaults
2.files
3.handlers
4.meta
5.tasks
6.templates
7.tests
8.vars

except files and templates, all other directories have main.yml file

defaults and vars carry variables. priority goes
to vars

task stores all playbook tasks grouped and maintained