scripts-misc/proxmox/create-debian-template.sh

27 lines
785 B
Bash
Raw Normal View History

2023-03-31 10:42:21 +02:00
#!/bin/bash
set -x
2024-12-10 08:36:43 +01:00
vmId=9001
pveStorage="local-lvm"
vmName="debian-12-${timestamp}.template.net"
2024-11-29 10:27:54 +01:00
timestamp=$(date '+%Y-%m-%d-%H-%M')
2024-12-10 08:36:43 +01:00
##################
2023-03-31 10:42:21 +02:00
2024-11-29 10:27:54 +01:00
wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2 -O debian-genericcloud-amd64.qcow2
2024-12-10 08:36:43 +01:00
qm destroy ${vmId}
2023-03-31 10:42:21 +02:00
2024-12-10 08:36:43 +01:00
qm create ${vmId} --cores 2 --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci --name "${vmName}"
2023-03-31 10:42:21 +02:00
2024-12-10 08:36:43 +01:00
qm set ${vmId} --scsi0 ${pveStorage}:0,import-from=/root/debian-genericcloud-amd64.qcow2
qm set ${vmId} --ide2 ${pveStorage}: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
2023-03-31 10:42:21 +02:00
2024-12-10 08:36:43 +01:00
qm template ${vmId}
2024-11-29 10:27:54 +01:00
rm debian-genericcloud-amd64.qcow2
2023-03-31 10:42:21 +02:00
set +x