role defaults
The variables in a role's defaults/main.yml: safe starting values that callers are expected to override.
In more detail
Role defaults have almost the lowest precedence of any variable source, so an inventory, a play or a caller's vars all win over them. That makes them the place for values such as a default site name. Values in vars/main.yml, by contrast, rank much higher and are not meant to be overridden casually.
Related terms
- Ansible role — A reusable package of tasks, handlers, templates, files and variables for one unit of automation, laid out in a standard directory structure.
- variable precedence — The fixed order Ansible uses to decide which value wins when the same variable is set in several places.
- environment overlay — Keeping one shared playbook and putting the values that differ between environments in separate variable files, one per environment.
Taught in
- The Standard Directory Layout And Roles — Ansible Configuration Management at Scale
- Writing A Role — Ansible Configuration Management at Scale
- Environment Specific Configuration — Ansible Configuration Management at Scale
- Roles: The Directory Ansible Expects, Defaults And Handlers — RHCE in Ansible (EX294): Automate Red Hat Systems