ansible/test/integration/targets/template/templates/72615-macro.j2
Martin Krizek a2af8432f3
Local vars should have highest precedence in AnsibleJ2Vars ()
Ability to add local variables into AnsibleJ2Vars was added in
18a9eff11f to fix . Local variables
are added using ``AnsibleJ2Vars.add_locals()`` method when creating a
new context - typically when including/importing a template with
context. For that use case local template variables created using
``set`` should override variables from higher contexts - either from the
play or any parent template, or both; Jinja behaves the same way.

Also removes AnsibleJ2Vars.extras instance variable which is not used.

Also adds missing test for .

Fixes 
Fixes 

ci_complete
2021-01-26 11:37:56 +01:00

8 lines
281 B
Django/Jinja

{% macro print_context_vars(value) %}
{{ foo }}
{{ value }}
{% set foo = "template-nested-level-foo" %}
{% set bar = "template-nested-level-bar" %}
{% from '72615-macro-nested.j2' import print_context_vars_nested with context %}
{{ print_context_vars_nested(bar) }}
{% endmacro %}