Terraform-provider-libvirt: [Question] PXE/iPXE boot and .XZ

Created on 6 Oct 2019  路  4Comments  路  Source: dmacvicar/terraform-provider-libvirt

Hi. Thank you for providing this module.
You can close this issue any time as this is just an general questions.

I see, i can provide CoreOS ignition files directly from TF, but is there a way to trigger a iPXE boot?
Basically, i have dedicated "bootstrapping" server (configured via Ansible) with DHCP, TFTP and Matchbox. With vanilla virt-install basically all i do is --pxe and passing --mac so machines gets their configs from DHCP server and Matchbox profiles and then chainload ignition configs.
Can this TF module handle similar scenario?

Other Q. is about .xz decompression. Fedora CoreOS provides qcow2.xz image, but libvirt_volume does not accept format = "xz". Is there a way to decompress that on the fly?
I am newbie in this space. Would be happy for some guidance.

need info question

Most helpful comment

@oswee HI thx for issue.

So regarding this xz from the UX perspective we don't support the format xz tar and gz or zip or other compressed image.

Time ago, I have tried to add this kind of feature however isn't that simple for many reasons. ( I don't say it is impossible, it just require some time). Also I came to conclusion that this issue is solvable in other ways which are elegants too ( see later)

But you can fix this really easy and without any code on the terraform level:

If you use a null_resource in terraform which will download and extract the compressed image, then you can create also the volume resource with uncompressed image.

Take look at this example:

https://github.com/kubic-project/kubic-init/blob/a1b520d9017763b72f5bc0f310f813c3f58b33af/deployments/tf-libvirt-full/terraform.tf#L166

So if you adapt this more or less, you can do:

  • downolad image
  • extract
  • 2nd volume resource depend on null resource and run the thing.

Hope it helps and let me know how it goes :sun_with_face:

All 4 comments

@oswee HI thx for issue.

So regarding this xz from the UX perspective we don't support the format xz tar and gz or zip or other compressed image.

Time ago, I have tried to add this kind of feature however isn't that simple for many reasons. ( I don't say it is impossible, it just require some time). Also I came to conclusion that this issue is solvable in other ways which are elegants too ( see later)

But you can fix this really easy and without any code on the terraform level:

If you use a null_resource in terraform which will download and extract the compressed image, then you can create also the volume resource with uncompressed image.

Take look at this example:

https://github.com/kubic-project/kubic-init/blob/a1b520d9017763b72f5bc0f310f813c3f58b33af/deployments/tf-libvirt-full/terraform.tf#L166

So if you adapt this more or less, you can do:

  • downolad image
  • extract
  • 2nd volume resource depend on null resource and run the thing.

Hope it helps and let me know how it goes :sun_with_face:

closing as resolved

I'd be interested in the first part of the question. There's already a ready to be used pxe server on the network and I'd like to use it to kickstart my vms.
Is there support in this provider for that, which I can't find?

@hfjn can you open a seperate issue ? tia

Was this page helpful?
0 / 5 - 0 ratings