Retrieve only depth=1 children for a group in inventory

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

no, inventory is flattened on read, so once in ansible there are no child groups/hosts, just hosts and it’s groups.

Don’t you think it could be a nice add to keep somewhere accessible the “model” that is described in the inventory ?