Skip to content

Instantly share code, notes, and snippets.

@tonyfairbanks
Forked from casperghst42/create-cloud-init.sh
Last active April 2, 2024 03:30
Show Gist options
  • Save tonyfairbanks/71e6705e206347ec9c916bb007bcc846 to your computer and use it in GitHub Desktop.
Save tonyfairbanks/71e6705e206347ec9c916bb007bcc846 to your computer and use it in GitHub Desktop.
Create a cloud-init Debian 12 image on proxmox
#!/bin/bash
# Author: Casper Pedersen (github.com/casperghst42)
# License: GPL2
wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2
virt-customize -a debian-12-generic-amd64.qcow2 --install qemu-guest-agent --install resolvconf --install systemd-resolved --install rsyslogd --update --run-command 'mkdir -p /etc/network/interfaces.d' --run-command 'echo "auto ens18" >> /etc/network/interfaces.d/ens18' --run-command 'echo "iface ens18 inet manual" >> /etc/network/interfaces.d/ens18'
qm create 100000 --name "debian12-cloudinit-template" --memory 2048 --net0 virtio,bridge=vmbr0 --agent enabled=1
qm importdisk 100000 debian-12-generic-amd64.qcow2 local-lvm -format qcow2
qm set 100000 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-100000-disk-0
qm resize 100000 scsi0 10G
qm set 100000 --ide2 local-lvm:cloudinit
qm set 100000 --boot c --bootdisk scsi0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment