Hi,

A problem I have often encountered when writing Ansible Roles is that the 
precedence level of "vars" prevents overriding them - in group_vars, 
inventory, etc. 

Perhaps this can be a solution, a set_fact task which converts selected 
Role Variables into Default Variables: 

https://www.samdarwin.com/ansible-default-vars/

Let me know your feedback or if you see any technical problems. Hopefully 
this will be useful for everyone who is composing Ansible Roles.

You might propose that if a role variable is going to be overridden, then 
it should just be set as a "default" in role/defaults/main.yml. Yes, that 
is fine for many common situations. However, include_vars does not work for 
defaults, only vars. There is no include_defaults. And why do you need 
that? It would allow for conditional logic such as per operating system 
settings.

-- 
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/67e514b0-995d-4c69-b51c-fb2905832ad5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to