host_vars
A directory whose files hold variables for single hosts, each file named exactly as the host is spelled in the inventory.
In more detail
It records the one machine that differs from its group, such as a host on an odd port, in a file whose name says which machine it is about. Host variables beat group variables for the same name, while values the host file does not mention still come from its groups.
Example
host_vars/web1.example.com.ymlRelated terms
- group_vars — A directory whose files hold variables for inventory groups, one file or folder per group, named exactly after the group.
- variable precedence — The fixed order Ansible uses to decide which value wins when the same variable is set in several places.
- inventory — The list of hosts Ansible may manage, arranged into groups and optionally carrying variables for each host or group.
Taught in
- Host Groups And Host Variables — Ansible Configuration Management at Scale
- Connections And Privilege Escalation — Ansible Configuration Management at Scale
- Variables And Precedence — Ansible Configuration Management at Scale
- Environment Specific Configuration — Ansible Configuration Management at Scale
- Static Inventories: Hosts, Groups And Groups Of Groups — RHCE in Ansible (EX294): Automate Red Hat Systems
- Inventory Variables: Ranges, group_vars And host_vars — RHCE in Ansible (EX294): Automate Red Hat Systems
- Variables And Where They Win: group_vars, host_vars And Play Vars — RHCE in Ansible (EX294): Automate Red Hat Systems
- Conditionals: register, when, changed_when And failed_when — RHCE in Ansible (EX294): Automate Red Hat Systems
- Git And VS Code: Clone, Commit, Push, And The Dev Container — RHCE in Ansible (EX294): Automate Red Hat Systems
- Users And Groups From A List, With Passwords That Settle — RHCE in Ansible (EX294): Automate Red Hat Systems