Customise VM template with cloud-init on Proxmox
Prerequisite
$ sudo apt update -y && sudo apt install libguestfs-tools -ySteps to prep the cloud image with cloud-init
$ wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img# install all desired packages in the cloud image
$ virt-customize -a jammy-server-cloudimg-amd64.img --install qemu-guest-agent,vim,bash-completion,wget,curl,unzip
# update all installed packages in the image
$ virt-customize -a jammy-server-cloudimg-amd64.img --update
# set preferred timezone
$ virt-customize -a jammy-server-cloudimg-amd64.img --timezone "Australia/Darwin"
# copy the ssh pubkey into the image
# that id_rsa.pub needs to be uploaded to the host in piror to run this command
$ virt-customize -a jammy-server-cloudimg-amd64.img --ssh-inject root:file:./id_rsa.pubLast updated