# suggestions to make my master playbook simpler

**URL:** <https://forum.ansible.com/t/suggestions-to-make-my-master-playbook-simpler/13708>\
**Category:** Ansible Project\
**Created:** [October 17, 2013, 1:42pm UTC](https://forum.ansible.com/t/suggestions-to-make-my-master-playbook-simpler/13708 "2013-10-17T13:42:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicolas\_G](https://avatars.discourse-cdn.com/v4/letter/n/a183cd/32.png) [@Nicolas\_G](https://forum.ansible.com/u/Nicolas_G)\
**Post date:** [October 17, 2013, 1:42pm UTC](https://forum.ansible.com/t/suggestions-to-make-my-master-playbook-simpler/13708/1 "2013-10-17T13:42:57Z")

</div>

Hi,

I have a master playbook to deploy 10 different group servers per region but would like to make things simpler. As you can see the vars\_files section and handlers bellow is the same on all groups, the only things that changes is the “hosts” line and the specific role for each group type. I could create 10 separate files for every group server and call all files from a master playbook using the “- include” statement but what I would really like to avoid here is to have to define all those same vars\_files and handlers for each group.

Is it possible to define all vars\_files and handlers in a single place ?

“”"

- hosts: A-group-servers  
user: root  
vars\_files:

# Global defaults

- group\_vars/all.yml

# Password & Access keys

- private\_vars/prod-secret-vars.yml

# Enviroment values

- group\_vars/prod-eu-west.yml  
handlers:

- include: roles/common/handlers/main.yml  
roles:

- { role : common , tags: [‘common-role’] }

- { role : visitor-profile , tags: [‘a-group-role’] }  
post\_tasks:

- include: roles/common/tasks/couchbase-rebalance.yml

- hosts: B-group-servers  
user: root  
vars\_files:

# Global defaults

- group\_vars/all.yml

# Password & Access keys

- private\_vars/prod-secret-vars.yml

# Enviroment values

- group\_vars/prod-eu-west.yml  
handlers:
- include: roles/common/handlers/main.yml  
roles:
- { role : common , tags: [‘common-role’] }
- { role : visitor-profile , tags: [‘b-group-role’] }

.  
.  
.  
.  
.  
“”"

Regards,  
Nicolas.

---

<div class="post-metadata">

**Author:** ![Andy1](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Andy1](https://forum.ansible.com/u/Andy1)\
**Post date:** [October 17, 2013, 2:32pm UTC](https://forum.ansible.com/t/suggestions-to-make-my-master-playbook-simpler/13708/2 "2013-10-17T14:32:08Z")

</div>

You could define a group for prod-eu-west. You can include other groups with

[prod-eu-west:children]  
A-group-servers roletag=a-group-role  
B-group-servers roletag=b-group-role

(untested)  
Described here:  
[https://github.com/ansible/ansible/blob/devel/docsite/rst/intro\_inventory.rst#groups-of-groups-and-group-variables](https://github.com/ansible/ansible/blob/devel/docsite/rst/intro_inventory.rst#groups-of-groups-and-group-variables)  
(I have no idea where this hides in the doc so I’m linking the github docsite)

HTH
