This is a common misconception. All groups that a host are in apply to the host during a run.
This is because groups may imply physical location, purpose, hardware type, and more, while you may only be selecting them by say, purpose. On Wed, Nov 12, 2014 at 11:20 AM, Tristan van Bokkem < [email protected]> wrote: > 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? > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/b25c4dd2-04dd-4779-848e-f1482ec77214%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/b25c4dd2-04dd-4779-848e-f1482ec77214%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgy5NFMpy-bupmQj2gbG89%3DcgPCSkW6CEONOamJuF2UzAA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
