Automation · Inventory
Variables
Cheat sheet · https://pcornel.dk/topic.php?topic=5844
Answer
Inventory variables are values attached to hosts or groups, such as ansible_host or ntp_servers, often kept in host_vars and group_vars directories, with host values overriding group values.
Remember
- Use host_vars and group_vars directories.
- Host values override group values.
- Vault secrets.
First checks
ansible-inventory --host <h> | jq .— effective vars- group_vars/host_vars structure — organisation
- No secrets in inventory files — security
Verify in this order
group/host vars → effective variables
Where it usually breaks
Inventory/vars → play/task selection → connection/become → module request → module result → target object read-back → handler/service effective state → workload verification.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5844