mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Test that we can override variables set in inventory when the vars_file name is templated
Fixes #8903
This commit is contained in:
parent
8dec4e3aac
commit
a9b5b1bf55
3 changed files with 20 additions and 0 deletions
|
@ -6,6 +6,13 @@ testhost2 ansible_ssh_host=127.0.0.1 ansible_connection=local
|
||||||
# by (preferred) group_vars/ and host_vars/ variables
|
# by (preferred) group_vars/ and host_vars/ variables
|
||||||
# and are used in testing of variable precedence
|
# and are used in testing of variable precedence
|
||||||
|
|
||||||
|
[inven_overridehosts]
|
||||||
|
invenoverride ansible_ssh_host=127.0.0.1 ansible_connection=local
|
||||||
|
|
||||||
|
[inven_overridehosts:vars]
|
||||||
|
foo=foo
|
||||||
|
var_dir=vars
|
||||||
|
|
||||||
[arbitrary_parent:children]
|
[arbitrary_parent:children]
|
||||||
local
|
local
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- debug: var=foo
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- 'foo == "bar"'
|
|
@ -26,3 +26,11 @@
|
||||||
- 'vars_files_var == "vars_files_var"'
|
- 'vars_files_var == "vars_files_var"'
|
||||||
- 'vars_files_var_role == "vars_files_var_role3"'
|
- 'vars_files_var_role == "vars_files_var_role3"'
|
||||||
- 'registered_var == "this is from set_fact"'
|
- 'registered_var == "this is from set_fact"'
|
||||||
|
|
||||||
|
- hosts: inven_overridehosts
|
||||||
|
vars_files:
|
||||||
|
- "{{ var_dir }}/test_var_precedence.yml"
|
||||||
|
roles:
|
||||||
|
- role: test_var_precedence_inven_override
|
||||||
|
foo: bar
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue