inventory scoped variables have less priority than globally scoped things.

This is expected, yes.


On Thu, Oct 30, 2014 at 5:13 AM, Nick <[email protected]> wrote:

> For the record, currently I am working around the aforementioned var
> precedence behaviour with a diabolical hack, as follows:
>
> ---
> - name: test
>   hosts: all
>   user: root
>
>   vars_files:
>
>     # Defines xxx.yyy default value. Diabolical hack, inserts
> inventory_hostname and then removes it.
>     - "vars.yml{{inventory_hostname| inventory_hostname|truncate(0,
> end='') }}"
>
>     # This can now override xxx.yyy
>     - "{{inventory_hostname}}.yml"
>
>   tasks:
>     - debug: msg="my var is {{ xxx.yyy }}"
>
> This tricks Ansible into putting the variables from vars.yml into the same
> precedence level as those from "{{inventory_hostname}}.yml" include.   I
> think it would make far more sense to the user if the precedence of
> included vars were simply dependent on the order of vars_files inclusion,
> whether the path is fixed or generated with "inventory_hostname", but for
> now this means I can actually make progress.
>
> Cheers,
>
> Nick
>
> --
> 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/54520149.8070608%40letterboxes.org.
>
> 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%2BnsWgyxhukwXmyvx3%3Dc%3DZqkWLzv96X6KQrnGKkEZAz1bq_JJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to