mirror of https://github.com/ansible/ansible.git
(cherry picked from commit 73e04ef2d6
)
pull/81192/head
parent
7a61d9fb11
commit
130fdcd50e
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- templating - In the template action and lookup, use local jinja2 environment overlay overrides instead of mutating the templars environment
|
@ -0,0 +1,4 @@
|
||||
var_a: << var_a >>
|
||||
var_b: << var_b >>
|
||||
var_c: << var_c >>
|
||||
var_d: << var_d >>
|
@ -1,28 +0,0 @@
|
||||
- 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
|
@ -0,0 +1,38 @@
|
||||
- hosts: localhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
output_dir: "{{ lookup('env', 'OUTPUT_DIR') }}"
|
||||
var_a: "value"
|
||||
var_b: "{{ var_a }}"
|
||||
var_c: "<< var_a >>"
|
||||
tasks:
|
||||
- set_fact:
|
||||
var_d: "{{ var_a }}"
|
||||
|
||||
- template:
|
||||
src: in_template_overrides.j2
|
||||
dest: '{{ output_dir }}/in_template_overrides.out'
|
||||
|
||||
- template:
|
||||
src: arg_template_overrides.j2
|
||||
dest: '{{ output_dir }}/arg_template_overrides.out'
|
||||
variable_start_string: '<<'
|
||||
variable_end_string: '>>'
|
||||
|
||||
- command: cat '{{ output_dir }}/in_template_overrides.out'
|
||||
register: in_template_overrides_out
|
||||
|
||||
- command: cat '{{ output_dir }}/arg_template_overrides.out'
|
||||
register: arg_template_overrides_out
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "'var_a: value' in in_template_overrides_out.stdout"
|
||||
- "'var_b: value' in in_template_overrides_out.stdout"
|
||||
- "'var_c: << var_a >>' in in_template_overrides_out.stdout"
|
||||
- "'var_d: value' in in_template_overrides_out.stdout"
|
||||
|
||||
- "'var_a: value' in arg_template_overrides_out.stdout"
|
||||
- "'var_b: value' in arg_template_overrides_out.stdout"
|
||||
- "'var_c: << var_a >>' in arg_template_overrides_out.stdout"
|
||||
- "'var_d: value' in arg_template_overrides_out.stdout"
|
Loading…
Reference in New Issue