Pcornel
Automation · Inventory

Inventory Validation

Cheat sheet · https://pcornel.dk/topic.php?topic=5850

Back to the Topic

Answer

Inventory validation checks that hosts are reachable, names and addresses are unique, required variables are set and groups are correct before automation runs against them.

Remember

  • Check reachability before running jobs.
  • Names and addresses must be unique.
  • Required variables must be set.

First checks

  • Inventory validation script (required vars, reachability) — checks
  • ansible all -m ping — reachability
  • Schema check of host vars — types

Commands

ansible-inventory --list
Print the parsed inventory, including groups and host variables, as JSON.

Verify in this order

inventory → validation → report

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=5850

Confirmation

Confirm action

Continue?