Removing the core plugin is unsupported and would create a legion of issues
if you were to file bugs on a version of ansible that ran different code
than everyone else is running.

I would recommend using it as implemented.




On Tue, Apr 29, 2014 at 1:04 PM, kesten broughton <
[email protected]> wrote:

> Serge, thanks for pointing me to the help.
>
> It seems that group_vars.py plugin runs after my plugin which gives the
> wrong precedence for what i need.
> Just to close the loop on this thread, my solution was to add
> self.priority = 1 in the constructor of VarsModule for my deploy_vars.py
> plugin and then this in
>  lib/ansible/inventory/__init__.py
>
>        #self._vars_plugins = [ x for x in
> utils.plugins.vars_loader.all(self) ]  # original line replaced by the
> lines below
>         # 21ct KB add priority to all deploy_vars to have higher
> precedence than group_vars
>         # higher priority value = higher precedence
>         unsorted_plugins = [ x for x in
> utils.plugins.vars_loader.all(self) if not hasattr(x,'priority')]
>         sorted_plugins = [ x for x in utils.plugins.vars_loader.all(self)
> if hasattr(x,'priority')]
>         sorted_plugins = sorted(sorted_plugins, key=lambda t:
> t.__getattribute__('priority'))
>         # last in list has highest precedence
>         self._vars_plugins = (unsorted_plugins or []) + (sorted_plugins or
> [])
>
> thanks for your assistance on this.
>
> kesten
>
> On Tuesday, April 1, 2014 12:52:04 PM UTC-5, Serge van Ginderachter wrote:
>
>>
>> On 1 April 2014 19:33, Kesten Broughton <[email protected]> wrote:
>>
>>> However, i'm not clear if dropping my group_vars into
>>> ansible/plugins/vars_plugins/group_vars.py will run before, after or
>>> instead of lib/ansible/inventory/vars_plugins/group_vars.py?
>>>  Is there a way to specify ordering / precedence of files in a plugin
>>> directory?  Maybe just point me to the plugin loader code?
>>>
>>
>> ​They will all run, and the order is not really defined, nor
>> configureable, though i *think* the core plugin will run first.
>>
>> Plugin loader code is in ​lib/ansible/utils/plugins.py.
>> The vars plugin get initialized in lib/ansible/inventory/__init__.py (at
>> the end of the Inventory constructor)
>>
>>  --
> 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/fb1c6e10-1342-4868-9048-17433bc92540%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/fb1c6e10-1342-4868-9048-17433bc92540%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%2BnsWgxD3BUeKYu0rkJxkjrkGjRkH933Sb7RFOYdE_Fa7dME%2Bw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to