variable precedence

The fixed order Ansible uses to decide which value wins when the same variable is set in several places.

In more detail

The general rule is that the more specific source wins: a host beats its group, a child group beats its parent, and every group beats all. Role defaults are near the bottom and extra variables given on the command line are at the top. Merging happens one variable at a time, so a host keeps values from its groups that its own file does not override. Rather than reason from the files, ask ansible-inventory --host what a host resolves to.

Related terms

Taught in

References

Certification courses