Skip to main content

Proxmox cloud init templates

·1 min

In order to use terraform as a IaC tool in a proxmox cluster cloud init templates are needed to generate vms from, in order to generate a cloud init template:

  • download cloud init image template (ubuntu 24.04 in this example)

on the proxmox host

cd /tmp/
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
virt-customize -a noble-server-cloudimg-amd64.img --install qemu-guest-agent
  • create a virtual machine that will become the template and import the disk with the image
qm create 9000 --name "ubuntu-2404-cloudinit-template" --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0
qm importdisk 9000 noble-server-cloudimg-amd64.img local-lvm
  • set scsi device emulation and other parameters
qm set 9000 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9000-disk-0
qm set 9000 --boot c --bootdisk scsi0
qm set 9000 --ide2 local-lvm:cloudinit
qm set 9000 --serial0 socket --vga serial0
qm set 9000 --agent enabled=1
  • convert vm to template
qm template 9000