Skip to content

Instantly share code, notes, and snippets.

@frobware
Created March 1, 2025 15:47
Show Gist options
  • Save frobware/e5be713b92268aa29fdca2e671e331a1 to your computer and use it in GitHub Desktop.
Save frobware/e5be713b92268aa29fdca2e671e331a1 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
set -eu
# https://ostechnix.com/import-qcow2-into-proxmox/
storage=local-zfs
vmid=9115
image=Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2
name=fedora-41-template
qm create $vmid --name $name --memory 8192 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci
(cd /var/lib/vz/template/qcow; qm importdisk $vmid $image ${storage})
qm set $vmid --scsihw virtio-scsi-pci --scsi0 ${storage}:vm-${vmid}-disk-0
qm set $vmid --ide2 ${storage}:cloudinit
qm set $vmid --boot c --bootdisk scsi0
qm set $vmid --serial0 socket --vga serial0
qm set $vmid --ipconfig0 ip=dhcp
curl -sL https://github.com/frobware.keys > /tmp/frobware.keys
qm set $vmid --sshkey /tmp/frobware.keys
qm set $vmid --ciuser aim
qm set $vmid --agent enabled=1,fstrim_cloned_disks=1
qm template $vmid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment