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/debug/main.yml

60 lines
1.3 KiB
YAML

- hosts: localhost
gather_facts: no
vars:
debug_me: hi mom
dictvar:
subdict1:
list1:
- value1
- value2
tasks:
- name: test item being present in the output
debug: var=item
loop: [1, 2, 3]
- name: ensure that explicitly-tagged unsafe debug var fails
debug:
var: !unsafe debug_me
ignore_errors: true
register: debug_out_unsafe
- assert:
that:
- debug_out_unsafe is failed
- debug_out_unsafe.msg is contains "untrusted template or expression"
- name: ensure that the same var templates properly when its expression is not marked unsafe
debug:
var: debug_me
register: debug_out_safe
- assert:
that:
- debug_out_safe.debug_me == 'hi mom'
- name: render a data structure
debug:
var: dictvar
register: result
- assert:
that:
- result.dictvar == dictvar
- name: statically pass a non-scalar to var
debug:
var:
some_diot:
sub_dict:
ignore_errors: true
register: result
- assert:
that:
- result is failed
- '"is not a string and conversion is not allowed" in result.msg'
- include_tasks: errors.yml
- include_tasks: args_templating.yml