Skip to content

Inventory Plugins

All inventory plugins use a config file. Ini or Yaml inventory files are still configuration files, they just happen to contain all the hostnames and ip addresses for the ini and yaml plugins directly.

Dynamic inventory plugins also need a config file, they all have a "plugin:" key which has to match the inventory filename. It is common for dynamic inventory plugins to have configuration in the contif file (which can be called anything) and for credentials to be read from environment variables.

Use ansible-inventory -i <config>.yml --list --yaml to debug the inventory generated by a dynamic inventory script. Note that the --export flag can significantly change the inventory and even exclude variables which would otherwise be included in the inventory.

For Collections, the [defaults] INVENTORY_PLUGINS key needs to be configured to specify the path to the folder where the inventory plugin .py file is located. I've not been able to get this working by just specifying the COLLECTIONS_PATH and inventory namespace.