Debian Codegraph @

test/integration/targets/template/ansible_managed.yml

raw
1 ---
2 - hosts: testhost
3 gather_facts: False
4 tasks:
5 - name: set output_dir
6 set_fact:
7 output_dir: "{{ lookup('env', 'OUTPUT_DIR') }}"
8 tags: ['always']
9
10 - name: Smoketest that ansible_managed with non-ascii chars works, https://github.com/ansible/ansible/issues/27262
11 tags: ['27262']
12 block:
13 - name: ensure output file does not exist
14 file:
15 path: '{{ output_dir }}/café.txt'
16 state: 'absent'
17
18 - name: test templating with unicode in template name
19 template:
20 src: 'templates/café.j2'
21 dest: '{{ output_dir }}/café.txt'
22
23 always:
24 - name: clean up!
25 file:
26 path: '{{ output_dir }}/café.txt'
27 state: 'absent'
28
29 - name: check strftime resolution in ansible_managed, https://github.com/ansible/ansible/pull/79129
30 tags: ['79129']
31 block:
32 - template:
33 src: "templates/%necho Onii-chan help Im stuck;exit 1%n.j2"
34 dest: "{{ output_dir }}/strftime.sh"
35 mode: '0755'
36
37 - shell: "exec {{ output_dir | quote }}/strftime.sh"
38
39 - name: Avoid templating 'injections' via file names
40 template:
41 src: !unsafe "templates/completely{{ 1 % 0 }} safe template.j2"
42 dest: "{{ output_dir }}/jinja.sh"
43 mode: '0755'
44
45 - shell: "exec {{ output_dir | quote }}/jinja.sh"
46 register: result
47
48 - assert:
49 that:
50 - "'Hello' in result.stdout"
51 - "'uname' not in lookup('file', output_dir ~ '/strftime.sh')"
52 - "'uname' not in lookup('file', output_dir ~ '/jinja.sh')"