1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

documented actual precedence (#38009)

fixes #22025
This commit is contained in:
Brian Coca 2018-04-05 14:09:12 -04:00 committed by scottb
parent 9cca9a9c10
commit 5ad13d66aa

View file

@ -862,10 +862,10 @@ Here is the order of precedence from least to greatest (the last listed variable
* role vars (defined in role/vars/main.yml) * role vars (defined in role/vars/main.yml)
* block vars (only for tasks in block) * block vars (only for tasks in block)
* task vars (only for the task) * task vars (only for the task)
* role (and include_role) params
* include params
* include_vars * include_vars
* set_facts / registered vars * set_facts / registered vars
* role (and include_role) params
* include params
* extra vars (always win precedence) * extra vars (always win precedence)
Basically, anything that goes into "role defaults" (the defaults folder inside the role) is the most malleable and easily overridden. Anything in the vars directory of the role overrides previous versions of that variable in namespace. The idea here to follow is that the more explicit you get in scope, the more precedence it takes with command line ``-e`` extra vars always winning. Host and/or inventory variables can win over role defaults, but not explicit includes like the vars directory or an ``include_vars`` task. Basically, anything that goes into "role defaults" (the defaults folder inside the role) is the most malleable and easily overridden. Anything in the vars directory of the role overrides previous versions of that variable in namespace. The idea here to follow is that the more explicit you get in scope, the more precedence it takes with command line ``-e`` extra vars always winning. Host and/or inventory variables can win over role defaults, but not explicit includes like the vars directory or an ``include_vars`` task.