|
Answer» There are two types of variables that can be defined in a role: - Role variables: loaded from ROLES/<role_name>/vars/main.yaml
- Role defaults: which are loaded from roles/<role_name>/defaults/main.yaml
- The difference between 'variables' and 'defaults' is the precedence order.
- Role defaults are the LOWEST order variables. Any other definition of a variable will take precedence over a role default.
- Role defaults can be THOUGHT of as placeholders for actual data, a reference of what variables a developer may be
- INTERESTED in defining with site-specific values.
- Role variables, on the other hand, have a higher order of precedence. Role variables can be overridden, but generally, they are used when the same data set is REFERENCED more than once within a role. If the data set is to be redefined with site-local values, then the variable should be listed in the role defaults rather than the role variables.
|