Hello!

I don't seem to be able to iterate over the hosts of a group of groups
within a template.

My inventory file looks similar to this:

        [group1]

        [group2]

        [group3:children]
        group1
        group2

The groups "group1" and "group2" are initially left empty. However, they
are populated with dynamically created EC2 instances by some playbook.

Later on, I have some tasks, which are just for hosts in group3:

        hosts: group3
        tasks:
                - ...

This works as expected, so I know that Ansible knows what group3 is and
what it consists of.

However, when I try to iterate over the hosts of group3 from within a
template (in some other tasks), it does not work:

        # Some template file
        {% for host in groups['group1'] %}  this works {% endfor %}
        {% for host in groups['group2'] %}  this works {% endfor %}
        {% for host in groups['group3'] %}  this does NOT work {% endfor %}

By "not working" I mean: The template engine seems to think that the
group3 is just empty.

Is that as intended? Is it a bug? Or am I just doing something wrong?

Any help would be greatly appreciated...

Thank you very much!

Juergen




-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1397013860.5876.33.camel%40localhost.
For more options, visit https://groups.google.com/d/optout.

Reply via email to