ansible-collections / community.libvirt

Manage libvirt with Ansible
http://galaxy.ansible.com/community/libvirt
GNU General Public License v3.0
61 stars 42 forks source link

Automate libvirt in an easier manner #50

Open ericzolf opened 3 years ago

ericzolf commented 3 years ago
SUMMARY

The current modules rely on XML which isn't very easy to create manually. I've started for myself to create few roles to make it easier, mainly based on virt-install. If there is interest, I would be very much willing to offer my roles as feature for this collection.

ISSUE TYPE
COMPONENT NAME

https://github.com/ericzolf/libvirt_automated

ADDITIONAL INFORMATION

See the example under https://github.com/ericzolf/libvirt_automated/tree/master/playbooks - I think it shows quite convincingly how easier it could be to create domains.

tabowling commented 3 years ago

Thank you for opening this Eric! We also have the official redhat.rhv collection in automation hub as the supported version of the ovirt content

https://cloud.redhat.com/ansible/automation-hub/repo/published/redhat/rhv/docs https://github.com/ovirt/ovirt-ansible-collection

I know ovirt assumes a lot more infrastructure, services, and functionality not present in base rhel, but I was meaning to check to see if the basic vm provisioning could help. I'd also love to see if we could co-develop standardized rhel hypervisor host role as part of the rhel-system-roles and https://linux-system-roles.github.io/ for simple hypervisor use cases as we are using here.

ericzolf commented 3 years ago

Sorry for taking so long to react but, yeah, we all have real work to do :-). The use case I personally mainly see for libvirt is my own laptop, so that I can setup demo environments. Ovirt would definitely be too invasive in this regard.

This said, I wouldn't mind to split my effort between system roles to setup the libvirt host (what I called libvirt_setup), and the libvirt collection to create VMs (my current domain_* roles).

In the meantime, I've also created an inventory plug-in which I could offer independently from this discussion. Shall I offer it as a separate PR? See https://github.com/ericzolf/libvirt_automated/blob/master/plugins/inventory/libvirt_inv.py

Tronde commented 1 year ago

Hey folks,
I develop a similar role for the same use case as @ericzolf described here. The kvm_provision_lab should ease the provisioning process of lab environments on KVM/QEMU hypervisors.

Already left a comment about it here.

If you find the time to look into it I appreciate any feedback. Please tell me if you find it useful or what you think in general about it.

Andersson007 commented 1 year ago

@Tronde hello, thanks for sharing the role! I'm a person unfamiliar with libvirt. Is it something that can be useful for the contributor community of this collection? Can your role help in development anyhow? (e.g. to set up testing infra or whatever)

Tronde commented 1 year ago

Hi @Andersson007,
Well wether my role coud be useful to the contributor community of this collection is for the community to decide. I could think of the following use caes.

Provision pre-defined lab environments

When I work with linux-system-roles or rhel-system-roles for example I'd like to test different roles against a set of EL releases to see how it works. I'd like to use the same lab containing the same amount of VMs with different releases. So I specify my lab in a var file, use the role kvm_provision_lab to deploy the VMs, run my tests afterwards and delete them. When I need them again, I just re-run my playbook.

The same goes for tests against Debian and Ubuntu. Iˋd like to use the same lab each time for my tests.

Example of how to use this collection

The role may serve as an example on how to use this collection as it depends on this collection an make heavy use of it. You could ship a role to deploy VMs to a KVM/QEMU hypervisor together with your colletion. Users would have some additional tooling to start with.

Cheers,
Tronde

Andersson007 commented 1 year ago

@Tronde cool, thanks for the explanation! If the collection maintainers find it interesting, they'll contact you, thanks a lot!