1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

reformated test, changed big assert to with_items

much easier to see the individual condition that causes the failure
when using with_items and evaluating each part of the assert individually
This commit is contained in:
Brian Coca 2015-12-01 21:11:12 -08:00
parent a1e8050760
commit c03afccc05

View file

@ -1,43 +1,45 @@
--- ---
- hosts: testhost - hosts: testhost
vars: vars:
- vars_var: "vars_var" - ansible_hostname: "BAD!"
- param_var: "BAD!" - vars_var: "vars_var"
- vars_files_var: "BAD!" - param_var: "BAD!"
- extra_var_override_once_removed: "{{ extra_var_override }}" - vars_files_var: "BAD!"
- from_inventory_once_removed: "{{ inven_var | default('BAD!') }}" - extra_var_override_once_removed: "{{ extra_var_override }}"
- from_inventory_once_removed: "{{ inven_var | default('BAD!') }}"
vars_files: vars_files:
- vars/test_var_precedence.yml - vars/test_var_precedence.yml
roles: roles:
- { role: test_var_precedence, param_var: "param_var" } - { role: test_var_precedence, param_var: "param_var" }
tasks: tasks:
- name: register a result - name: register a result
command: echo 'BAD!' command: echo 'BAD!'
register: registered_var register: registered_var
- name: use set_fact to override the registered_var - name: use set_fact to override the registered_var
set_fact: registered_var="this is from set_fact" set_fact: registered_var="this is from set_fact"
- debug: var=extra_var - debug: var=extra_var
- debug: var=extra_var_override_once_removed - debug: var=extra_var_override_once_removed
- debug: var=vars_var - debug: var=vars_var
- debug: var=vars_files_var - debug: var=vars_files_var
- debug: var=vars_files_var_role - debug: var=vars_files_var_role
- debug: var=registered_var - debug: var=registered_var
- debug: var=from_inventory_once_removed - debug: var=from_inventory_once_removed
- assert: - assert:
that: that: item
- 'extra_var == "extra_var"' with_items:
- 'extra_var_override == "extra_var_override"' - 'extra_var == "extra_var"'
- 'extra_var_override_once_removed == "extra_var_override"' - 'extra_var_override == "extra_var_override"'
- 'vars_var == "vars_var"' - 'extra_var_override_once_removed == "extra_var_override"'
- 'vars_files_var == "vars_files_var"' - 'vars_var == "vars_var"'
- 'vars_files_var_role == "vars_files_var_role3"' - 'vars_files_var == "vars_files_var"'
- 'registered_var == "this is from set_fact"' - 'vars_files_var_role == "vars_files_var_role3"'
- 'from_inventory_once_removed == "inventory_var"' - 'registered_var == "this is from set_fact"'
- 'from_inventory_once_removed == "inventory_var"'
- hosts: inven_overridehosts - hosts: inven_overridehosts
vars_files: vars_files:
- "test_var_precedence.yml" - "test_var_precedence.yml"
roles: roles:
- role: test_var_precedence_inven_override - role: test_var_precedence_inven_override
foo: bar foo: bar