Let's say I have 3 files in group_vars:
abc.yml all.yml xyz.yml
And the same variable defined in them:
- my_var: abc - my_var: all - my_var: xyz
Ansible documentation says:
In any section, overriding var will overwrite the previous instance. If several groups have the same variable, the last loaded one wins. If you define a variable twice in the "Games vars:" section, the second wins.
Does this mean that the boot order is alphabetical and abc.yml has the lowest priority, while xyz.yml is the highest, or does it depend on the order of the groups in hosts ?
What is the boot order?
Interestingly, changing the order of groups in hosts also changes the results, but in an unpredictable way.
I tried running ansible-playbook my_var.yml -c local (which returns the value of a variable) with all the combinations:
[all] localhost [xyz] localhost [abc] localhost
but I still canโt understand how this works.
variables order ansible
Nick roz
source share