Variable combining several lists

34 views
Skip to first unread message

Michael Mahemoff

unread,
Mar 10, 2014, 3:40:14 AM3/10/14
to ansible...@googlegroups.com
Is there any way to define a variable as being the combination of several lists. For example, define "database_clients" as being the combination of all items in groups['app_servers'] and groups['processors']. I'd rather define it once rather than use with_items in different places to combine them.

I looked at set_fact (http://docs.ansible.com/set_fact_module.html), but don't think it's possible that way.

Brian Coca

unread,
Mar 10, 2014, 7:42:06 AM3/10/14
to ansible...@googlegroups.com
you can define in hosts file 

[database_clients:children]
processors
app_servers


or in other ways groups['processors']|union(groups['app_servers'])

Michael Mahemoff

unread,
Mar 10, 2014, 10:52:06 AM3/10/14
to ansible...@googlegroups.com
That works, thanks.
Reply all
Reply to author
Forward
0 new messages