Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure Jinja2 template header overrides are used (#75306)
Fixes #75275
- Loading branch information
Showing
5 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
changelogs/fragments/75275-ensure-jinja2-header-overrides-used.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- template - ensure Jinja2 overrides from template header are used (https://github.com/ansible/ansible/issues/75275) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#jinja2:variable_start_string:'<<' , variable_end_string:'>>' | ||
var_a: << var_a >> | ||
var_b: << var_b >> | ||
var_c: << var_c >> | ||
var_d: << var_d >> |
28 changes: 28 additions & 0 deletions
28
test/integration/targets/template/in_template_overrides.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
- hosts: localhost | ||
gather_facts: false | ||
vars: | ||
var_a: "value" | ||
var_b: "{{ var_a }}" | ||
var_c: "<< var_a >>" | ||
tasks: | ||
- set_fact: | ||
var_d: "{{ var_a }}" | ||
|
||
- block: | ||
- template: | ||
src: in_template_overrides.j2 | ||
dest: out.txt | ||
|
||
- command: cat out.txt | ||
register: out | ||
|
||
- assert: | ||
that: | ||
- "'var_a: value' in out.stdout" | ||
- "'var_b: value' in out.stdout" | ||
- "'var_c: << var_a >>' in out.stdout" | ||
- "'var_d: value' in out.stdout" | ||
always: | ||
- file: | ||
path: out.txt | ||
state: absent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters