group_vars on many groups ?

22 views
Skip to first unread message

Charly Koza

unread,
Jul 2, 2015, 2:50:28 PM7/2/15
to ansible...@googlegroups.com
Hello !

I somehow need to
- assign applications to groups of hosts
- have a host in several groups in the platform
- get the list of deployed applications in the platform
- be able to get the list of hosts with the application.

I tried like that : 

I'm trying to have a variable (dokku_apps) defined for multiple groups.
depending on the target server (testing, prod, and so on), a single host can use many groups or only one.

the idea is that a group should configure some dokku apps. so if a host is in many groups it should configure dokku apps specific to each of its group

my problem is that when a host is in many groups, the dokku_apps (configured in group_vars) is only from a single group (the latest i think) and is not merged (as expected from documentation) 

I'm also using this list (dokku_apps) to configure varnish.

How can i achieve that ?


Serge van Ginderachter

unread,
Jul 5, 2015, 11:55:01 AM7/5/15
to ansible...@googlegroups.com
​Given that variables are merged according to group priorities, and there is no some default way to add-up some lists, this is hard to achive cleanly.​

A workaround might be to put this data in dictionaries, and enable dict merging in ansible.cfg


TBH, I never found a clean wat to do this kind of construct. It should be something we want to enable when revamping inventory things.

Reply all
Reply to author
Forward
0 new messages