guides/Creating-new-role.md
2020-07-15 12:52:27 +05:00

791 B

#New Role

Once you are super sure you find a sub module and its independent you can create a Role for it that can be used in different playbooks

Directory structure

  1. Defaults:- Here we need to define all vars in main.yml that will be used later on in this role
  2. Files:- Here we put all those files which are related to role's business requirements, like we want to ran a docker container or setup a nginx server and all supporting files will be here
  3. Tasks:- All doable tasks will be here by default all tasks in main.yml are defined here
  4. Templates:- This is the directory which is responsible for generating files during run time, also behaves like a bridge.
  5. .travis.yml:- In this file we define all the dependencies of current role.