# On any node — pick one with enough storage for the template
cd /var/lib/vz/template/iso
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
wget https://cloud-images.ubuntu.com/resolute/current/resolute-server-cloudimg-amd64.img
# Bake qemu-guest-agent into the image before import (so you don't have to
# boot, install, shutdown, template). Install libguestfs-tools first.
apt install -y libguestfs-tools
virt-customize -a noble-server-cloudimg-amd64.img \
--install qemu-guest-agent \
--run-command 'systemctl enable qemu-guest-agent'
# Create the template VM shell (use a high ID, e.g. 9024 for noble, 9026 for resolute)
qm create 9024 --name ubuntu-2404-tmpl --memory 2048 --cores 2 \
--net0 virtio,bridge=vnpriv --ostype l26 --agent enabled=1
qm importdisk 9024 noble-server-cloudimg-amd64.img local-zfs
qm set 9024 --scsihw virtio-scsi-pci \
--scsi0 local-zfs:vm-9024-disk-0,discard=on,ssd=1
qm set 9024 --ide2 local-zfs:cloudinit
qm set 9024 --boot order=scsi0
qm set 9024 --serial0 socket --vga serial0
# Convert to template (read-only, can't be started, only cloned from)
qm template 9024