expanding lists

Hi,

I have a list of groups

admin:
groups: [‘group-boapp-layout-A’, ‘group-boapp-layout-B’]

Each of these groups has a number of hosts as defined in the inventory

(note that this info needs to be global as opposed to per group_vars/group-boapp-layout-A.yml so that it can be accessed by other groups)

[group-boapp-layout-A]
ec2-test-boapp01
ec2-test-boapp02

[group-boapp-layout-B]
ec2-test-boapp03
ec2-test-boapp04

[tier-boapp:children]
group-boapp-layout-A
group-boapp-layout-B

GROUPS Variables (“groups”):

A possible solution if I can’t expand the lists into one list is to define a different group of hosts specifically for the application. Though that seems messier

You have group theory filters like |union that can help with this.
Note that with_flattened was buggy in 1.8.1, should be fixed in 1.8.2.
I would also avoid the - in names whenever possible, it creates issues
with certain methods of access.

Hi,

Thanks for that. I have tried to avoid the “in” approach though I have found that the information about where things needs to live needs to be accessed from multiple tiers / groups

I.e apache configuration on the web tier needs to know the hosts that the application is configured on.

I’ll have a rethink of my approach as I do agree that it should be avoided if possible.

Interesting about 1.8.2. I’ll keep an eye on that. I was pretty sure it was doing what I was expecting prior to 1.8.1.

Many thanks

James