mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
YAML
39 lines
1.3 KiB
YAML
1 year ago
|
- 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"
|