summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/yaml_parsing/tasks/unsafe.yml
blob: 8d9d627b72630551a8336c26497f8b0df329639c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
- name: ensure no templating unsafe
  block:
  - name: check unsafe string
    assert:
      that:
        - regstr != resolved
        - "'Fail' not in regstr"
        - "'{' in regstr"
        - "'}' in regstr"
    vars:
      regstr: !unsafe b{{nottemplate}}

  - name: check unsafe string in list
    assert:
      that:
        - ulist[0] != resolved
        - "'Fail' not in ulist[0]"
        - "'{' in ulist[0]"
        - "'}' in ulist[0]"
    vars:
      ulist: !unsafe [ 'b{{nottemplate}}', 'c', 'd']

  - name: check unsafe string in dict
    assert:
      that:
        - udict['a'] != resolved
        - "'Fail' not in udict['a']"
        - "'{' in udict['a']"
        - "'}' in udict['a']"
    vars:
      udict: !unsafe
        a: b{{nottemplate}}
        c: d
  vars:
    nottemplate: FAIL
    resolved: 'b{{nottemplate}}'