summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/undefined/tasks/main.yml
blob: bbd82845852349276c651844ae0543b215f282ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
- when: lookup('pipe', ansible_playbook_python ~ ' -c "import jinja2; print(jinja2.__version__)"') is version('2.7', '>=')
  block:
    - set_fact:
        names: '{{ things|map(attribute="name") }}'
      vars:
        things:
          - name: one
          - name: two
          - notname: three
          - name: four

    - assert:
        that:
          - '"%r"|format(an_undefined_var) == "AnsibleUndefined"'
          - '"%r"|format(undef()) == "AnsibleUndefined"'
          # The existence of AnsibleUndefined in a templating result
          # prevents safe_eval from turning the value into a python object
          - names is string
          - '", AnsibleUndefined," in names'