Is it possible to get the child groups of a given group in an expression

From a quick look at https://github.com/ansible/ansible/blob/devel/lib/ansible/inventory/group.py I think the answer is “no” as child_groups doesn’t have a getter, but just in case…

Is it possible to get the list of child groups of a given group?

The use case here would be for a jinja template (pseudo):

{% for my_group in groups['my-cluster'] %} { "name" : "{{ my_group.name }}", "hosts" : [ {% for host in groups['{{ my_group.name }}] %}{"fqdn" : "{{ hostvars[host]['inventory_hostname'] }}"}{% if not loop.last %},{% endif %} {% endfor %}] }{% if not loop.last %},{% endif %} {% endfor %}

There is an easy workaround which involves some duplication, but just curious if there’s a way to get the above to work.