How get list of child groups in Ansible Jinja Template?

Viewed 96

I use ansible module template to create config.

I have a inventory file, that contains.

[workapp]
server1
[testapp]
server2
[db]
sdb
[app:children]
workapp
testapp
devapp

How i can get list child groups in app? I tried do that in template file

{% for groups in groups['app'] %}
     {{ groups }}
{% endfor %}

But in this case i get list of servers in all child groups belong app, i.e

server1
server2

but i want get list

workapp
testapp
devapp

Any methods to get child groups? Ansible version 2.9.27 Ubuntu 18.04

0 Answers
Related