Hello,
I face a strange behaviour on Ansible 2.2.2, which I didn’t have on 1.9. Inventory group vars seems to be defined after all the vars in my playbook
My inventory:
inventory/
production/
production
group_vars/
all.yml
My playbook:
-
hosts: all
vars_files: -
vars/{{stage}}/frontend/main.yml
-
vars/{{stage}}/frontend/{{front_name}}.yml
-
vars/{{stage}}/frontend/{{group_names[0]}}.yml
stage is defined in inventory/production/group_vars/all.yml
When I run my playbook, it fails loading my var_files because stage does not exist.
if I replace my playbook with the following, it works:
-
hosts: all
vars_files: -
“{{ inventory_dir }}/group_vars/all.yml”
-
vars/{{stage}}/frontend/main.yml
-
vars/{{stage}}/frontend/{{front_name}}.yml
-
vars/{{stage}}/frontend/{{group_names[0]}}.yml
Best regards,
Fred