Thanks for explaining that. It seem I have a pretty common use case, so it feels strange there isn't a more direct way of solving it. I see what you mean by mixing 2 loading methods though. I structured it this way following http://toja.io/using-host-and-group-vars-files-in-ansible/
There were other blog posts about multistage ansible environments, but this one was by far the simplest. As a workaround, I might have my dynamic inventory script put all groups in a single supergroup "all_groups" to allow me to override vars at the env-level (e.g. env/dev/group_vars/all_groups). Or is there a better way to specify a var default at the inventory level (instead of play level)? On Tuesday, December 16, 2014 2:51:17 PM UTC-7, Brian Coca wrote: > > Your plays are at the level of top env (assumed from how you call > debug.yml) and they load that group_vars, this is how you load > inventory vars at the play level (different from play vars). It is > meant to override the inventory as plays are more specific than > inventory. > > if you do not want this to be the case, put the inventory outside the same > hier, > > env/ > plays/ > > Then it would be ansible-playbook -i ../env/dev debug.yml and the > ../env/group_vars/all will NOT be sourced. > You are mixing 2 loading methods, one is part of inventory, the other > part of plays, I think this is what is confusing you. > > -- > Brian Coca > -- 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/d483b23e-09f9-472c-8c84-a3a504a93e1b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
