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/config/types.yml

29 lines
1.3 KiB
YAML

- hosts: localhost
gather_facts: false
tasks:
- name: ensures we got the values we expected
block:
- name: initialize plugin
debug: msg={{ lookup('types', 'starting test') }}
- set_fact:
valid: '{{ lookup("config", "valid", plugin_type="lookup", plugin_name="types") }}'
mustunquote: '{{ lookup("config", "mustunquote", plugin_type="lookup", plugin_name="types") }}'
notvalid: '{{ lookup("config", "notvalid", plugin_type="lookup", plugin_name="types") }}'
totallynotvalid: '{{ lookup("config", "totallynotvalid", plugin_type="lookup", plugin_name="types") }}'
str_mustunquote: '{{ lookup("config", "str_mustunquote", plugin_type="lookup", plugin_name="types") }}'
- assert:
that:
- 'valid|type_debug == "list"'
- 'mustunquote|type_debug == "list"'
- 'notvalid|type_debug == "list"'
- 'totallynotvalid|type_debug == "list"'
- 'str_mustunquote|type_debug == "AnsibleUnsafeText"'
- valid[0]|int == 1
- mustunquote[0]|int == 1
- "notvalid[0] == '[1'"
# using 'and true' to avoid quote hell
- totallynotvalid[0] == "['1'" and True
- str_mustunquote == "foo"