# How to automatically handle slight difference in configuring Master-slave setup

**URL:** <https://forum.ansible.com/t/how-to-automatically-handle-slight-difference-in-configuring-master-slave-setup/23860>\
**Category:** Ansible Project\
**Created:** [March 2, 2017, 9:19am UTC](https://forum.ansible.com/t/how-to-automatically-handle-slight-difference-in-configuring-master-slave-setup/23860 "2017-03-02T09:19:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishan\_jain](https://avatars.discourse-cdn.com/v4/letter/i/dc4da7/32.png) [@ishan\_jain](https://forum.ansible.com/u/ishan_jain)\
**Post date:** [March 2, 2017, 9:19am UTC](https://forum.ansible.com/t/how-to-automatically-handle-slight-difference-in-configuring-master-slave-setup/23860/1 "2017-03-02T09:19:38Z")

</div>

I am preparing some Ansible scripts for a service that works in a master/slave setup. There is a single docker image for both but the master/slave behavior will be acquired after configuring some environment variables.

When i explicitly setup each container, this is roughly how my playbook would look:

---

<div class="post-metadata">

**Author:** ![dch](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dch/32/7132_2.png) [@dch](https://forum.ansible.com/u/dch)\
**Post date:** [March 2, 2017, 7:35pm UTC](https://forum.ansible.com/t/how-to-automatically-handle-slight-difference-in-configuring-master-slave-setup/23860/2 "2017-03-02T19:35:25Z")

</div>

I've dealt with this in 2 different ways in the past depending on scale.  
In both cases I have a single group (call it lb for loadbalancer) with  
the nodes in it, but use dynamic lookups for the latter more complex  
scenario.

In one case, I used per-host variables - effectively a manual  
declaration:

/p/i/ansible ╍{} cat host\_vars/b\*
