From the course: Ansible: From Basics to Guru by Pearson

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Plugin-based inventory

Plugin-based inventory

Plugins are also used for inventory. Now inventory can be written in any format as well as a YAML format. Any format is easy because it's just a flat list of hosts and YAML format allows you to work with a more sophisticated hierarchy. But inventory, since a long time, has been managed through plugins and the Ansible CFG which plugins are used in the Inventory section. And using plugins allows Ansible to support new inventory format by just providing a new plugin, so it makes it more flexible. The Indie plugin supports old style inventory format. The Script plugin supports old style dynamic inventory, where you would have a script that is querying some system to figure out what needs to be added to the inventory. The YAML plugin supports new style YAML format inventory. And using plugins is preferred over using dynamic inventory scripts. That is becoming interesting if you are using heterogeneous environments where your inventory needs to be automatically discovered. Now here we have…

Contents