Terraform create VyOS from ISO
-
Hey, new to forum.
BLUF: How can I create a VM from ISO file using terraform? Things seem to have changed--I have tried what I found online and keep running into issues.
Xen Orchestra latest commit cb6cf
XCP-ng 8.2.1 (GPLv2)
vatesfr/xenorchestra v0.29.0Want to use terraform to create a VyOS router in XCP-ng. I have done before manually. I would like to create the VM for the VyOS router from the ISO with the correct interfaces.
It looks like I can't use the template "Other install media" and supply a cdrom{}. When I try, the iso file is not found.
In the future, I would like to use cloud-init to spin up the VyOS router. Until then, I'm looking to spin up with terraform and configure using Ansible.
Here is the full code.
https://github.com/doritoes/NUC-Labs/tree/xcp-ng-improvement/XCP-ng/terraformThe full XCP-ng build steps I used are documented there too.
data "xenorchestra_network" "wan" { name_label = "Pool-wide network associated with eth0" } data "xenorchestra_network" "build" { name_label = "build" depends_on = [xenorchestra_network.vlan_network_100] } data "xenorchestra_template" "template" { name_label = "Other install media" } data "xenorchestra_sr" "local" { name_label = "Local storage" } data "xenorchestra_sr" "ISO" { name_label = "ISO" } data "xenorchestra_vdi" "vyos_rolling" { name_label = "vyos-1.5-rolling-202407010024-amd64.iso" } resource "xenorchestra_vm" "vyos" { memory_max = 1073733632 cpus = 2 #cloud_config = name_label = "vyos" name_description = "vyos router" template = data.xenorchestra_template.template.id cdrom { id = data.xenorchestra_vdi.vyos_rolling.id } disk { sr_id = data.xenorchestra_sr.local.id name_label = "vyos-router-disk" size = 8589869056 } network { network_id = data.xenorchestra_network.wan.id } network { network_id = data.xenorchestra_network.build.id } }
-
To looks like I need to learn about packer since VyOS has some packer builds
-
@SethNY Hi !
I'm working since a few weeks to have a VyOS packer build working with the XCP-ng packer provider. The link you provided is only for qemu build, so it needs some work to be able to adapt it to XCP-ng.
I'll tell you when I have something working, but for now, I have some small difficulty to resolve (install the tools, and other small things).If you want to use terraform, you can do this:
- Prepare a VM manually, with the bare minimum
- Convert the VM to a template.
- And use this template with terraform
I don't know if cloudinit is supported out of the box or if you need to activate some things (I'm not here yet), but if you have something working, I'll think it will be helpful for the community
-
@AtaxyaNetwork Thank you for the feedback.
It looks like there's now way around completing my VMs and converting to them templates. But that's ok!
I took your advice and am successfully creating my own templates manually. One good thing with VyOS is I can enable xe-guest-utilities in the template, something I wanted to do in cloud-init.
I will use Ansible to configure the router.