Reputation: 401
how could I override variable in following situation: playbook/roles/role1/defaults/main.yml
# Example1
myvars:
var1: val1
var2: val2
I'd like to override only 1 variable from this hash, something like
# Example1
myvars:
var2: val2-new
I've added to playbook.yml following construction:
vars_files:
- vars/local_conf_options.yml
vars/local_conf_options.yml has content from Example2 And I get error about undefined variable var1.
How I could resolve this issue?
PS: I've tried to rename 'defaults' to 'vars', but got the same error.
Upvotes: 1
Views: 6403
Reputation: 68269
You can modify hash_behaviour to merge
. The default is replace
.
But be careful, this is global setting! Some other parts of your playbooks may break because of this change.
Upvotes: 4