Hi,
I’d like to know how others are dealing with keeping their group_vars files granular. Ours have become a little unwieldily and we’re considering approaches to breaking them apart.
When we provision a server, we assign it to a number of groups. Among those groups, each server is added to at least three groups. Firstly, we add it to a group which defines its role, for example app_server. Another group represents the location of the DC that the server is in, which might be LON, for example. Thirdly, we also add it to a group which denotes whether it is a production server or a test server, prod, for example. That allows us to use ansible’s patterns when we’re configuring the server to do something like this: - hosts: “prod:&LON:&app_server” or - hosts: “prod:&ORD:&app_server”.
We have a variables which need to be defined based on these three variables, Environment, Region and Role. Our current thinking is to create a group_vars file for each of the possible combinations, prod_LON_app_server, for example. The affect of this decision will mean that we’re going to see an explosion in the number of groups a server is added to, and the number of group_vars files we maintain.
Before we take this route, can anyone tell me if we’re missing a trick? Is there a technique that we’re missing?
Thanks!
Dan.