Hi,
As explained here http://docs.ansible.com/intro_inventory.html#splitting-out-host-and-group-specific-data we are using multiple environments (acceptance / production) with ansible-playbooks and have set it up as follow:
deploy.yml
inventory
_ inventory-production
_inventory-acceptance
group_vars/
_ acceptance/group1
_ acceptance/group2
_ production/group1
_ production/group2
host_vars/
_ host1.accept
_ host2.accept
_ host1.prod
_ host2.prod
…
We have for instance some iptables vars defined in group1 and group2. Each specific for their group of hosts.
Now when we run the ansible playbook deploy.yml together with the inventory-production inventory it soon start to work on a host in group1. It will run the tasks for the iptables role and the taks will need vars from the group_vars directory. However it seems it is using the vars that has been combined of both groups and it will use the vars which are alphabetical last. Which in this case is group2. So it is using the wrong vars.
Any idea why this is going wrong?