Hello,
I do many tests and I don’t understand the group_vars load order in ansible 2. With ansible 1 vars are load in my playbook order. But with ansible 2 it seems to be totally random.
For example:
I have 2 groups:
group_vars# tree
├── all.yml
├── site_plo.yml
toto: foo
└── machine_ehp.yml
toto: bar
I place my machine in thats groups with this playbook :
-
name: Dynamically define site
group_by: “key=site_{{ inventory_hostname_short[0:3] }}” -
name: Dynamically define environment
group_by: “key=machine_{{ inventory_hostname_short[3:6] }}” -
debug: var=toto
In this configuration toto=foo
When I rename machine_eh1 there is no logic :
amachine_eh1: toto=bar
bmachine_eh1: toto=bar
cmachine_eh1: toto=bar
dmachine_eh1: toto=foo
emachine_eh1: toto=bar
zmachine_eh1: toto=foo
There is a bug ? a specific order rule ? a random rule ?
Thanks for your help