Debian Codegraph @

test/integration/targets/lookup_template/tasks/main.yml

raw
1 # ref #18526
2 - name: Test that we have a proper jinja search path in template lookup
3 set_fact:
4 hello_world: "{{ lookup('template', 'hello.txt') }}"
5
6 - assert:
7 that:
8 - "hello_world|trim == 'Hello world!'"
9
10
11 - name: Test that we have a proper jinja search path in template lookup with different variable start and end string
12 vars:
13 my_var: world
14 set_fact:
15 hello_world_string: "{{ lookup('template', 'hello_string.txt', variable_start_string='[%', variable_end_string='%]') }}"
16
17 - assert:
18 that:
19 - "hello_world_string|trim == 'Hello world!'"
20
21 - name: Test that we have a proper jinja search path in template lookup with different comment start and end string
22 set_fact:
23 hello_world_comment: "{{ lookup('template', 'hello_comment.txt', comment_start_string='[#', comment_end_string='#]') }}"
24
25 - assert:
26 that:
27 - "hello_world_comment|trim == 'Hello world!'"
28
29 # 77004
30 - assert:
31 that:
32 - lookup('template', 'dict.j2') is not mapping
33
34 - include_tasks: trim_blocks.yml
35 - include_tasks: ansible_managed.yml
36
37 - name: Verify templates with no rendered content return `None`
38 assert:
39 that: "{{ lookup('template', 'none.j2') is none }}"