--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/afaeac27-07cf-4e10-8504-ade22c361540%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I'd like the included vars injected with the same precedence as those in defaults/main.yml rather than the precedence of vars/main.yml. The documentation is not clear on the what precendence include_vars get.
From my testing, vars coming from include_vars have a higher precedence than inventory vars so they can not be overridden by inventory vars.
Taking:
1. -e variables always win 2. then comes "most everything else" 3. then comes variables defined in inventory 4. then comes facts discovered about a system 5. then "role defaults", which are the most "defaulty" and lose in priority to everything.
I'd like the included vars to have the precedence of 5, rather than 2
> You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/2VbVHrb0Xrc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwr3ukLhnDdS9%3DZjM%3D1MPVte1D4H2RAbx_h%2BmkjJiDChg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAKAnEVsDUvn0ttxxHeAFYTdiZS_7V21-yaHd%3DZRpeMhv_4by-A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwWjMtLa01gR7zda0Tq%2BLMa8N%2B46S5TCMKeQhA3bBOXUg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAKAnEVvsKZ%2Br_ms-4RDUNcS2%2B5uOz9if4nYujcVUeTZxu3Rf1w%40mail.gmail.com.
In the docs on precedence, discovered facts come under inventory but the include_vars facts are actually higher precedence than the inventory.
Being able to have a default_vars module would, I maintain, be a boon for reusable roles. They can be less opinionated and fit more circumstances. It allows for user control while not requiring configuration from the end user for the role to work.
Is it something I could implement as a module for my own use or is the variable registration more ingrained than that?
Thanks for your time,
Matt
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgxkUWZ9OjCFzrdd4sn4q37cgx1iTOodLSB8cvBdxis_ZA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAKAnEVuO1mhEZbqKX8mY8%3DO9g3KVfr309WtLjp274Z-M0-rW1g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5360C83C.9080907%40faita.net.
- name: Include hostname specific vars
include_vars:
file: "host_vars/{{ inventory_hostname }}.yml"