In order to fully automate host provisioning, we need to eliminate the manual step of adding hosts to the Ansible inventory. Ansible has had the _community.libvirt.libvirt_ inventory plugin for quite a while, but by itself it is insufficient, as it has no way to add hosts to groups dynamically. It does expose the domain XML, but parsing that and extracting group memberships from that using Jinja templates would be pretty terrible. Thus, I decided the easiest and most appropriate option would be to develop my own dynamic inventory plugin. * Supports multiple _libvirt_ servers * Can connect to the read-only _libvirt_ socket * Can optionally exclude VMs that are powered off * Can exclude VMs based on their operating system (if the _libosinfo_ metadata is specified in the domain metadata) * Can add hosts to groups as specified in the domain metadata * Exposes guest info as inventory host variables (requires QEMU guest agent running in the VM and does not work with a read-only _libvirt_ connection) |
||
---|---|---|
.. | ||
pyrocufflink.py |