#!/bin/bash set -x vmid=9001 timestamp=$(date '+%Y-%m-%d-%H-%M') vmname=debian-12-$timestamp.template.net wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2 -O debian-genericcloud-amd64.qcow2 qm destroy ${vmid} qm create ${vmid} --cores 2 --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci --name $vmname qm set ${vmid} --scsi0 pve:0,import-from=/root/debian-genericcloud-amd64.qcow2 qm set ${vmid} --ide2 pve:cloudinit qm set ${vmid} --boot order=scsi0 qm set ${vmid} --agent enabled=1 qm set ${vmid} --ostype l26 qm set ${vmid} --serial0 socket --vga serial0 qm resize ${vmid} scsi0 +6G qm template ${vmid} rm debian-genericcloud-amd64.qcow2 set +x