ansible-role-libvirt-vm icon indicating copy to clipboard operation
ansible-role-libvirt-vm copied to clipboard

Install VM with virt-builder

Open raspbeguy opened this issue 4 years ago • 7 comments

Hello,

I open this issue because I wish to implement a way to install VMs with virt-builder (from libguestfs project).

I wish to list here everything we need to think about and the useful information.

  • virt-builder can set up some basic settings on the VM OS, like the hostname and the root password. It can also copy a file to the desired location on the VM volume.
  • virt-builder downloads (from a libguestfs-maintained repository or a custom one) a template of a given OS (containing partitions) and deploy it on a file (raw or qcow) or on a block device, with ability to automatically expand the partitions to fit the given device.
  • Sadly, virt-builder can't yet use qemu storage backends to access target storage, so you have to map it to a block device in order to deploy on it using virt-builder. For instance, for RBD, you have to map it using RADOS kernel module or RBD-NBD implementation.

Do you think this is a good idea?

raspbeguy avatar Jul 01 '20 14:07 raspbeguy

Hi, I'm wondering if there is any overlap between this and what we already have in this role? If not, maybe it would make sense as a separate role?

markgoddard avatar Jul 02 '20 10:07 markgoddard

i.e. would a virt-builder implementation just replace the entire role, or would it reuse any existing code?

markgoddard avatar Jul 02 '20 10:07 markgoddard

I think it would be another method of provisionning a VM.

If I understand correctly, there is currently only 2 ways to provision a VM volume: image and backing_image. We could add a third option builder.

raspbeguy avatar Jul 02 '20 10:07 raspbeguy

I think it sounds like an alternative without too much overlap. I'd suggest making a separate role.

markgoddard avatar Jul 02 '20 11:07 markgoddard

Could you explain a bit? I don't think it will overlap that much.

raspbeguy avatar Jul 02 '20 14:07 raspbeguy

What I mean is that I don't think there will be much overlap. This role is one way to make a VM, and virt-builder is another way. I think adding both options to one role would be confusing.

markgoddard avatar Jul 02 '20 14:07 markgoddard

OK, I see. Thanks for clarifying.

raspbeguy avatar Jul 02 '20 14:07 raspbeguy