Hi,
i’m working with ansible 1.5 and encounter a problem when working with includes in templates.
In one template file i have this code snippet:
{% for group in group_names %}
{% include “debug_include.j2” with context %}
{% endfor %}
In the included template ‘debug_include.j2’ i have this code:
This is the included Template. The current group is {{group}}
The documentation claims that included templates have the same variable context as the main file.
So i would expect to see something like:
This is the included Template. The current group is mailserver
Instead i get an error on the commandline when executing this play:
TASK: [common-linux | dump all variables] *************************************
fatal: [ltesthost] => {‘msg’: “One or more undefined variables: ‘group’ is undefined”, ‘failed’: True}
fatal: [testhost] => {‘msg’: “One or more undefined variables: ‘group’ is undefined”, ‘failed’: True}
FATAL: all hosts have already failed – aborting
Did i miss somthing here ?