26 lines
785 B
Bash
Executable file
26 lines
785 B
Bash
Executable file
#!/bin/bash
|
|
set -x
|
|
|
|
vmId=9001
|
|
pveStorage="local-lvm"
|
|
vmName="debian-12-${timestamp}.template.net"
|
|
timestamp=$(date '+%Y-%m-%d-%H-%M')
|
|
##################
|
|
|
|
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 ${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
|
|
|
|
qm template ${vmId}
|
|
rm debian-genericcloud-amd64.qcow2
|
|
|
|
set +x
|