One common challenge our customers face is the need to track hosts from multiple sources: LDAP, cloud providers, and enterprise CMDB systems. Today we are going to cover dynamic inventory plugins as a Collection for network device management through an /etc/hosts file. This same type of setup can be used for creating any dynamic inventory using different items from /etc/hosts files to ini files or even csv’s.

├── collections │ └── ansible_collections │ └── ansible │ └── network │ └── plugins │ └── inventory │ └── etc_hosts.py ├── etc_hosts.yml └── hosts 6 directories, 4 files

Here is a snippet of the Python plugin: name: Etc_Hosts Inventory plugin_type: inventory author: - Eric McLeroy (@jmcleroy) short_description: Dynamic inventory plugin for a etc/hosts network file.

Related Articles