2014-05-09 18:42:45 +02:00
|
|
|
---
|
|
|
|
- hosts: testhost
|
|
|
|
vars:
|
|
|
|
- vars_var: "vars_var"
|
|
|
|
- param_var: "BAD!"
|
|
|
|
- vars_files_var: "BAD!"
|
2014-11-26 19:55:37 +01:00
|
|
|
- extra_var_override_once_removed: "{{ extra_var_override }}"
|
|
|
|
- from_inventory_once_removed: "{{ inven_var | default('BAD!') }}"
|
2014-05-09 18:42:45 +02:00
|
|
|
vars_files:
|
|
|
|
- vars/test_var_precedence.yml
|
|
|
|
roles:
|
|
|
|
- { role: test_var_precedence, param_var: "param_var" }
|
|
|
|
tasks:
|
2014-09-03 16:39:50 +02:00
|
|
|
- name: register a result
|
|
|
|
command: echo 'BAD!'
|
|
|
|
register: registered_var
|
|
|
|
- name: use set_fact to override the registered_var
|
|
|
|
set_fact: registered_var="this is from set_fact"
|
2014-05-09 18:42:45 +02:00
|
|
|
- debug: var=extra_var
|
2014-11-26 19:55:37 +01:00
|
|
|
- debug: var=extra_var_override_once_removed
|
2014-05-09 18:42:45 +02:00
|
|
|
- debug: var=vars_var
|
|
|
|
- debug: var=vars_files_var
|
2014-08-15 22:57:02 +02:00
|
|
|
- debug: var=vars_files_var_role
|
2014-09-03 16:39:50 +02:00
|
|
|
- debug: var=registered_var
|
2014-11-26 19:55:37 +01:00
|
|
|
- debug: var=from_inventory_once_removed
|
2014-05-09 18:42:45 +02:00
|
|
|
- assert:
|
|
|
|
that:
|
|
|
|
- 'extra_var == "extra_var"'
|
2014-11-26 19:55:37 +01:00
|
|
|
- 'extra_var_override == "extra_var_override"'
|
|
|
|
- 'extra_var_override_once_removed == "extra_var_override"'
|
2014-05-09 18:42:45 +02:00
|
|
|
- 'vars_var == "vars_var"'
|
|
|
|
- 'vars_files_var == "vars_files_var"'
|
2014-08-15 22:57:02 +02:00
|
|
|
- 'vars_files_var_role == "vars_files_var_role3"'
|
2014-09-03 16:39:50 +02:00
|
|
|
- 'registered_var == "this is from set_fact"'
|
2014-11-26 19:55:37 +01:00
|
|
|
- 'from_inventory_once_removed == "inventory_var"'
|
2014-09-10 00:41:58 +02:00
|
|
|
|
|
|
|
- hosts: inven_overridehosts
|
|
|
|
vars_files:
|
|
|
|
- "{{ var_dir }}/test_var_precedence.yml"
|
|
|
|
roles:
|
|
|
|
- role: test_var_precedence_inven_override
|
|
|
|
foo: bar
|
|
|
|
|