From 6640d91fe9d41956f9b6a4de4bceb12ffd8fda73 Mon Sep 17 00:00:00 2001 From: "ITmail.dk v/ Martin Andersen" Date: Mon, 12 Feb 2024 11:13:18 +0100 Subject: [PATCH] EDIT --- proxmox_debian-cloud-image-vm-template.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/proxmox_debian-cloud-image-vm-template.sh b/proxmox_debian-cloud-image-vm-template.sh index 51988c8..7af9242 100644 --- a/proxmox_debian-cloud-image-vm-template.sh +++ b/proxmox_debian-cloud-image-vm-template.sh @@ -2,14 +2,16 @@ #Proxmox - Debian-Cloud-Image VM Template URLIMG="https://cloud.debian.org/images/cloud/bookworm/latest" IMGFILENAME="debian-12-generic-amd64.qcow2" +SSHPUBKEY=/root/ssh-public-key.pub VMID="9000" VMNAME="Debian-12-Cloud-Image" -VMUSER="user" -VMPASSWORD="Code24" +VMUSER="username" +VMPASSWORD="Pass24" VMSTORAGE="local-lvm" echo "Start of NEW VM Debian-Cloud-VM" -echo "Check if the config file is there and if it is, then we delete the machine and the config files and prepare to make >if [ -f /etc/pve/qemu-server/$VMID.conf ]; then +echo "Check if the config file is there and if it is, then we delete the machine and the config files and prepare to make a new vm" +if [ -f /etc/pve/qemu-server/$VMID.conf ]; then qm destroy $VMID else echo "The $VMID.conf file is not there, ok" @@ -22,5 +24,6 @@ if [ -f $IMGFILENAME ]; then else echo "The file is not there, prepare to download" fi -wget $URLIMG/$IMGFILENAME && qm create $VMID --name $VMNAME --agent 1 --ostype l26 --cores 4 --sockets 1 --cpu x86-64-v2-A>cd /root -echo "THE NEW $VMNAME VM IS TEMPLATE DONE" \ No newline at end of file +wget $URLIMG/$IMGFILENAME && qm create $VMID --name $VMNAME --agent 1 --ostype l26 --cores 4 --sockets 1 --cpu x86-64-v2-AES --memory 4096 --balloon 2048 --scsihw virtio-scsi-single --scsi0 $VMSTORAGE:0,import-from=/tmp/$IMGFILENAME --boot order=scsi0 --serial0 socket --vga serial0 --net0 model=virtio,bridge=vmbr0,firewall=1 --ide2 $VMSTORAGE:cloudinit --ciuser $VMUSER --cipassword $VMPASSWORD --sshkeys "$SSHPUBKEY" --ipconfig0 ip=dhcp --onboot 0 && qm resize $VMID scsi0 +53G && qm template $VMID +cd /root +echo "THE NEW $VMNAME VM IS DONE" \ No newline at end of file