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/validation.yml

25 lines
1.1 KiB
YAML

- hosts: localhost
gather_facts: false
tasks:
- name: does nothing but an empty assign, should fail only if lookup gets invalid options
set_fact: whatever={{ lookup('bogus', 1, test_list=['Dan', 'Manuela']) }}
- name: now pass invalid option and fail!
set_fact: whatever={{ lookup('bogus', 1, test_list=['Dan', 'Manuela', 'Yoko']) }}
register: bad_input
ignore_errors: true
- name: ensure it fails as expected
assert:
that:
- bad_input is failed
- '"Invalid value " in bad_input.msg'
- '"valid values are:" in bad_input.msg'
- name: test config option casting
set_fact:
direct: "{{ lookup('casting', 1, test_list=[1,2,3], test_int=1, test_bool=True, test_str='lola') }}"
from_strings: "{{ lookup('casting', 1, test_list='1,2,3', test_int='1', test_bool='true', test_str='lola') }}"
direct_individual: "{{ lookup('casting_individual', 1, test_list='1,2,3', test_int='1', test_bool='true', test_str='lola') }}"
from_strings_individual: "{{ lookup('casting_individual', 1, test_list='1,2,3', test_int='1', test_bool='true', test_str='lola') }}"