Variables
There are two types of variables that can be defined in a role. There are role variables, loaded from roles/<role_name>/vars/main.yaml, and there are role defaults, loaded from roles/<role_name>/defaults/main.yaml. The difference between vars and defaults has to do with precedence order. Refer to Chapter 1, The System Architecture and Design of Ansible, for a detailed description of the order. Role defaults are the lowest order variables. Literally 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access