You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/jinja2_native_types/test_casting.yml

25 lines
907 B
YAML

- name: cast things to other things
set_fact:
int_to_str: "{{ i_two|to_text }}"
str_to_int: "{{ s_two|int }}"
dict_to_str: "{{ dict_one|to_text }}"
list_to_str: "{{ list_one|to_text }}"
int_to_bool: "{{ i_one|bool }}"
str_true_to_bool: "{{ s_true|bool }}"
str_false_to_bool: "{{ s_false|bool }}"
- assert:
that:
- 'int_to_str == "2"'
- 'int_to_str|type_debug in ["str", "unicode"]'
- 'str_to_int == 2'
- 'str_to_int|type_debug == "int"'
- 'dict_to_str|type_debug in ["str", "unicode"]'
- 'list_to_str|type_debug in ["str", "unicode"]'
- 'int_to_bool is sameas true'
- 'int_to_bool|type_debug == "bool"'
- 'str_true_to_bool is sameas true'
- 'str_true_to_bool|type_debug == "bool"'
- 'str_false_to_bool is sameas false'
- 'str_false_to_bool|type_debug == "bool"'