Automation · Inventory
Dynamic Inventory
Cheat sheet · https://pcornel.dk/topic.php?topic=5846
Answer
Dynamic inventory generates the host list at runtime from a source like AWS, vSphere, Proxmox or NetBox using plugins, so automation always targets what actually exists.
Remember
- Dynamic inventory is generated at runtime from a source.
- Plugins exist for cloud, vSphere and NetBox.
- Caching speeds up large inventories.
First checks
ansible-inventory -i netbox.yml --list | jq '._meta.hostvars | length'— NetBox dynamicansible-doc -t inventory netbox.netbox.nb_inventory— plugin docs- Cache settings — performance
Verify in this order
API → plugin → inventory
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=5846