ansible-inventory
The command that shows how Ansible parsed the inventory, as a tree of groups or as the resolved variables for one host.
In more detail
--graph draws groups and hosts as a tree, --host <name> prints every variable that applies to that host after merging all sources, and --list prints everything as JSON. When an inventory surprises you, ask this command what it read before rereading the files.
Examples
ansible-inventory --graphansible-inventory --host web1.example.comRelated terms
- inventory — The list of hosts Ansible may manage, arranged into groups and optionally carrying variables for each host or group.
- group_vars — A directory whose files hold variables for inventory groups, one file or folder per group, named exactly after the group.
- host_vars — A directory whose files hold variables for single hosts, each file named exactly as the host is spelled in the inventory.
- variable precedence — The fixed order Ansible uses to decide which value wins when the same variable is set in several places.
Taught in
- Ansible Architecture And The Control Node — Ansible Configuration Management at Scale
- The Static Inventory File — Ansible Configuration Management at Scale
- Host Groups And Host Variables — Ansible Configuration Management at Scale
- Dynamic Inventory — 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
- ansible.cfg: Which File Wins, And The Settings That Matter — RHCE in Ansible (EX294): Automate Red Hat Systems
- SSH Keys And An Account For Ansible — 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
- Mock Exam, Part 1: Seven Tasks Across Three Sections — RHCE in Ansible (EX294): Automate Red Hat Systems