Variable precedence

We specified variable defaults, used them in inventory files, and defined the same variable from different places (for example, defaults, vars, and inventory). Let's now analyze the output of the templates to understand what happened with all those variables.

The following is the figure showing the my.cnf file on Ubuntu:

Variable precedence

The following is the analysis of the screenshot:

  • The file has a notice in the comments section. This can deter admins from making manual changes to the file.
  • Most of the variables come from the defaults in a role. This is because Debian is our default family of operating systems and we already have sane defaults ...

Get Ansible Playbook Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.