Did this make it into 2.3 and if so where would I find constants.py to 
change the default precedence order?  I would have thought something like 
this would be set in ansible.cfg

I've been wading through the many posts on how variable precedence works 
and many including one from you on another post state:

playbook/group_vars are meant to override the inventory as plays are more 
> specific than inventory. 

This doesn't make sense to me (and a lot of other people it seems), I had 

   1. A playbook applies a set of roles to one or more servers (i.e. *what* 
   to do), it would naturally follow that playbooks/group_vars/<group>.yml 
   apply to all servers in the playbook.  
   2. An inventory file defines which servers the playbook will apply the 
   roles to (i.e. *where* to do it), it *should* natually follow that we 
   can use inventories/<name>/group_vars/<group>.yml to override playbook 
   group_vars as inventories are more specific about where to run tasks than 

With the playbook taking precedence over inventories there is no obvious 
place to have "global" variables for a group (as defined in inventory file) 
that can be overridden as needed in each inventory. All.yml doesn't make 
the cut as this can't be used to define group level variables.

So, if this change for changing the default precedence order has not yet 
made it into Ansible can you point me at any documentation that can show me 
how to define global variables for groups that can be overridden .  All the 
links I've followed try to jump though hoops to do what should be a simple 
excercise and the ansible documentation is rather quiet on the subject 
(unless I've missed something) - which is a common complaint in the posts 
I've been reading.


On Wednesday, May 24, 2017 at 2:15:48 AM UTC+12, Brian Coca wrote:

> in constants.py: 
> VARIABLE_PRECEDENCE       = get_config(p, DEFAULTS, 'precedence', 
> ['all_inventory', 'groups_inventory', 'all_plugins_inventory', 
> 'all_plugins_play', 'groups_plugins_inventory', 
> 'groups_plugins_play'], value_type='list') 
> Which would allow you to switch the group vars precedence, the above 
> list is the default and matches the current docs. 
> On Tue, May 23, 2017 at 10:12 AM, Szabolcs Póta <szabol...@gmail.com 
> <javascript:>> wrote: 
> > Hi Brian, 
> > 
> > Thank you for the answer. I have read through your inventory plugin 
> proposal 
> > JIRA, PR and docs but cannot see where precedence can actually be 
> > configured. I see that inventory types are now nicely refactored to be 
> > handled by plugins and that they can be enabled or disabled but can't 
> see 
> > where precedence is set. 
> > 
> > Could you please give me the necessary config option? (The above links 
> do 
> > redirect me and the pages jump around so probably pasting here directly 
> is 
> > better). What I would like is to have INI with higher precedence than 
> > group_vars relative to inventory files. 
> > 
> > Thanks, 
> > 
> > Szabolcs 
> > 
> > 
> > On Monday, May 22, 2017 at 5:26:22 PM UTC+2, Brian Coca wrote: 
> >> 
> >> I might have a 'solution' ... configurable precedence, this is 
> >> something I've been toying with in 
> >> http://github.com/ansible/ansible/issues/23001. 
> >> 
> >> config setting (need to add to examples/ansible.cfg) : 
> >> 
> >> 
> https://github.com/ansible/ansible/pull/23001/files#diff-b77962b6b54a830ec373de0602918318R249
> >> 
> >> draft implementation: 
> >> 
> >> 
> https://github.com/ansible/ansible/pull/23001/files#diff-473ef6db3f086739e3c053f001d731b5R257
> >> 
> >> 
> >> ---------- 
> >> Brian Coca 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Ansible Development" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to ansible-deve...@googlegroups.com <javascript:>. 
> > For more options, visit https://groups.google.com/d/optout. 
> -- 
> ---------- 
> 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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
For more options, visit https://groups.google.com/d/optout.

Reply via email to