Skip to content
runonprem

Config generators

Proxmox cloud-init template generator

Build a Proxmox VE VM template from an official Debian or Ubuntu cloud image: a cloud-init user-data file with your user, SSH keys, packages and the QEMU guest agent, plus the exact qm commands to import the image and turn it into a template you can clone in seconds.

MB
GB

snippets/debian-vm-user.yaml

#cloud-config
hostname: debian-vm
timezone: UTC
users:
  - name: admin
    groups: [sudo]
    shell: /bin/bash
    sudo: "ALL=(ALL) NOPASSWD:ALL"
    lock_passwd: true
    ssh_authorized_keys:
ssh_pwauth: false
package_update: true
package_upgrade: true
packages:
  - qemu-guest-agent
  - curl
  - htop
runcmd:
  - [systemctl, enable, --now, qemu-guest-agent]

Proxmox host commands

# On the Proxmox host (as root). The snippet storage needs the "snippets" content type:
#   pvesm set local --content iso,vztmpl,backup,snippets
# Save the user-data as /var/lib/vz/snippets/debian-vm-user.yaml (path of the "local" storage).

wget -O /root/debian-12-genericcloud-amd64.qcow2 https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2
qm create 9000 --name debian-vm-template --ostype l26 --memory 2048 --cores 2 --cpu host \
  --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-single --agent enabled=1 \
  --serial0 socket --vga serial0
qm set 9000 --scsi0 local-lvm:0,import-from=/root/debian-12-genericcloud-amd64.qcow2,discard=on
qm resize 9000 scsi0 32G
qm set 9000 --ide2 local-lvm:cloudinit --boot order=scsi0 --ipconfig0 ip=dhcp
qm set 9000 --cicustom "user=local:snippets/debian-vm-user.yaml"
qm template 9000

# New VM from the template (full clone), then start it:
#   qm clone 9000 9001 --name debian-vm --full && qm start 9001

How to use it

  1. Enter hostname, user and at least one SSH public key; password login stays disabled.
  2. Pick the cloud image and the VM ID, storage and bridge names of your Proxmox host.
  3. Enable the "snippets" content type on the snippet storage and save the user-data file in its snippets folder (/var/lib/vz/snippets for the "local" storage).
  4. Run the commands on the Proxmox host as root, then clone the template (full clone) for each new VM.

Formula and method

qm create   VM with virtio network, virtio-scsi-single, serial console, guest agent
qm set      --scsi0 <storage>:0,import-from=<image>   (import the cloud image as the disk)
qm resize   scsi0 <size>G
qm set      --ide2 <storage>:cloudinit --boot order=scsi0 --ipconfig0 ip=dhcp
qm set      --cicustom "user=<snippet storage>:snippets/<file>"
qm template <vmid>

Worked example

For Debian 12 with VM ID 9000 on local-lvm the commands download debian-12-genericcloud-amd64.qcow2, import it with qm set 9000 --scsi0 local-lvm:0,import-from=/root/debian-12-genericcloud-amd64.qcow2, grow it with qm resize 9000 scsi0 32G, attach the cloud-init drive and snippets/debian-vm-user.yaml, and finish with qm template 9000.

FAQ

Why use a cloud image instead of the installer ISO?

Cloud images are small, preinstalled systems built for cloud-init. A clone boots in seconds with your user, keys and packages already set up, instead of going through the installer for every VM.

Why install the QEMU guest agent?

It lets Proxmox show the VM’s IP addresses, shut it down cleanly and freeze the file system for consistent backups and snapshots.

Can I set a static IP address?

Yes: replace --ipconfig0 ip=dhcp with, for example, --ipconfig0 ip=192.168.1.50/24,gw=192.168.1.1 on the clone, or set it per VM in the Cloud-Init tab.

Related tools

Formulas reviewed November 27, 2026 by Novian · runs entirely in your browser · methodology