summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/set_fact/set_fact_bool_conv_jinja2_native.yml
blob: 2642599f48952cc214954e56f9a910a8c39017be (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
- hosts: localhost
  gather_facts: false
  vars:
    string_var: "no"
  tasks:
    - set_fact:
        this_is_string: "yes"
        this_is_not_string: yes
        this_is_also_string: "{{ string_var }}"
        this_is_another_string: !!str "{% set thing = '' + string_var + '' %}{{ thing }}"
        this_is_more_strings: '{{ string_var + "" }}'

    - assert:
        that:
          - string_var == 'no'
          - this_is_string == 'yes'
          - this_is_not_string == True
          - this_is_also_string == 'no'
          - this_is_another_string == 'no'
          - this_is_more_strings == 'no'

    - ansible.builtin.set_fact:
        this_is_string_fqcn: "yes"
        this_is_not_string_fqcn: yes
        this_is_also_string_fqcn: "{{ string_var }}"
        this_is_another_string_fqcn: !!str "{% set thing = '' + string_var + '' %}{{ thing }}"
        this_is_more_strings_fqcn: '{{ string_var + "" }}'

    - assert:
        that:
          - this_is_string_fqcn == 'yes'
          - this_is_not_string_fqcn == True
          - this_is_also_string_fqcn == 'no'
          - this_is_another_string_fqcn == 'no'
          - this_is_more_strings_fqcn == 'no'