Hi,
Looks like I am jumping into the deep end on making Ansible work for us. We have a large set of legacy apps that require more than the simple instances.
I am trying to use Ansible in a single point of truth model to generate some complex configs. The idea of this is that any piece of information is only kept in one place in the system. I was planing to represent this in group hierarchies, so I have 50-100 services and for each service there is a parent group, serviceN, and a child group of serviceN_dcD. The child group contains the list of instances that provide the service in data center D.
There is a group call haproxy1_dc1 which is a child of haproxy1 which is a child of haproxy. haproxy1 group has a list of services that it handles, lets say service1, service4 and service 17. haproxy1_dc1 has that dc1 is the primary dc, dc3 is the secondary dc and the set of instances. service1 has that the default port is 55101 (a list) and the cert needed is Y . service1_dc1 has that the listener address is 10.2.3.4 and the list of instances that provide the service.
We now have all the information needed to build the haproxy config for a haproxy_dc1 instance. Now come the questions:
In the playbook for installing haproxy, I have my haproxy role and the haproxy groups. It doesn’t make sense to me to include all the information about the services here, since in the general case I need all the services which would include all the systems. Is this right?
In the case described, I need to access the groups service1, service1_dc1 and service1_dc3 in the template. Those references need to be dynamically built from data in the haproxy_dc1 and haproxy1 data. How do I do dynamic references like this and what does it end up looking like in the template?
thanks in advance,
jerry