From 51732b2cb70c75c161edddb6437f9213243137b7 Mon Sep 17 00:00:00 2001 From: Shaz hemani Date: Wed, 15 Jul 2020 12:52:27 +0500 Subject: [PATCH] Creating new Playbooks and roles --- Creating-new-playbook.md | 15 +++++++++++++++ Creating-new-role.md | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 Creating-new-playbook.md create mode 100644 Creating-new-role.md diff --git a/Creating-new-playbook.md b/Creating-new-playbook.md new file mode 100644 index 0000000..66c2e44 --- /dev/null +++ b/Creating-new-playbook.md @@ -0,0 +1,15 @@ +#New playbook + +##### Create new playbook only if you see there is an independent task that is need to be performed on node + +**Content of playbook** + +1. Host + Mention all nodes of which you want this playbook to run +2. Vars + If you want to use any variables in current playbook you may introduce them here +3. Tasks + Series of tasks can be provided but, it is recommended to add tasks in Roles and use those roles in current playbook +4. Roles + Roles are to be created when we have found a sub independent task and those roles can become part of playbook + diff --git a/Creating-new-role.md b/Creating-new-role.md new file mode 100644 index 0000000..230d00c --- /dev/null +++ b/Creating-new-role.md @@ -0,0 +1,17 @@ +#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. + \ No newline at end of file