Docker Inventory Module + Configuration

Hey guys,

I’m in the process of wrapping up on a Docker inventory plugin, but before I open a pull request, I wanted to check about something.

Here’s a link for those interested: https://github.com/angstwad/ansible/tree/docker_inv/plugins/inventory

The question is about my use of a YAML-formatted confuration file. Note, this is in addition to supporting environment variables. I noticed that nearly all the modules in Inventory are using INI-formatted files, but this is probably because their dependent libraries support INI-formatted config files. Since docker-py has no such support, I figured I’d go with YAML files. The YAML config file enumerates Docker hosts and options, and a defaults section that could apply to all hosts.

tl;dr: I use a YAML file for enumerating Docker hosts. Everything else seems to use INI. INI files are (mostly) dumb.

Thanks!

If you think it needs structured data that seems reasonable…

The hosts section being blank in the sample file is a bit confusing to me, maybe include some commented out hosts?

Note in reading the code inventory plugins don’t have a DOCUMENTATION section for auto-generated docs so you can drop that boilerplate, instead include notes on configuration as docs in the config file. Otherwise it’s a bit confusing as I’m reading the docs expecting it to be a module, and it’s unclear what the config file might look like.

(Do I read the source correctly that this will be able to index containers running on multiple hosts? If so, this would be very very good – it seems also nice if it would return the lists of configured hosts in a “docker_hosts” group or equivalent, so that you could use the docker module to add more to them?)

Thanks!!