I’ve got a design question – I’ve got a somewhat complicated nested yaml object which will specify some parameter values that need to be set differently on different hosts. Prior to this particular case, I’ve been comfortable using the roles system along with host_vars and group_vars to represent this kind of host or role-specific variation.
For this particular case though, there are some potential interdependencies between the correct values for these parameters – because of that my instinct is to define a global variable in group_vars/all.yml indexed by inventory_hostname. But I could also just override the variable value in host_vars as normal, but somehow I imagine there will be a time when I need to change these values for multiple hosts at the same time – and somehow it seems more clear to keep these values defined together.
Does defining a variable indexed by ansible_hostname seem like an anti-pattern? Wondering if my instincts seem sensible to others or not …