Retrieve only depth=1 children for a group in inventory

21 views
Skip to first unread message

Christophe Boivin

unread,
Feb 9, 2016, 11:56:22 AM2/9/16
to Ansible Project
Hello,

I would like to get a list of only children of depth 1 for a certain group

If my inventory is :
[group_a:children]
group_b
group_c


[group_b]
host1
host2

[group_c]
host3


When I try to loop on items of group_a:children i will get [host1, host2, host3]

Is there any way to get [group_b, group_c] ?

Thanks in advance

Christophe

Brian Coca

unread,
Feb 9, 2016, 12:59:03 PM2/9/16
to ansible...@googlegroups.com
no, inventory is flattened on read, so once in ansible there are no child groups/hosts, just hosts and it's groups.


Christophe Boivin

unread,
Feb 9, 2016, 2:52:16 PM2/9/16
to Ansible Project
Don't you think it could be a nice add to keep somewhere accessible the "model" that is described in the inventory ?
Reply all
Reply to author
Forward
0 new messages