EDIT
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
#Proxmox - Ubuntu-Cloud-Image VM Template
|
#Proxmox - Ubuntu-Cloud-Image VM Template
|
||||||
URLIMG="https://cloud-images.ubuntu.com/jammy/current/"
|
URLIMG="https://cloud-images.ubuntu.com/jammy/current"
|
||||||
IMGFILENAME="jammy-server-cloudimg-amd64.img"
|
IMGFILENAME="jammy-server-cloudimg-amd64.img"
|
||||||
SSHPUBKEY=/root/ssh-public-key.pub
|
SSHPUBKEY="/root/ssh-public-key.pub"
|
||||||
VMID="9002"
|
VMID="9002"
|
||||||
TAGS="Template"
|
TAGS="Template"
|
||||||
VMNAME="Ubuntu-Cloud-Image"
|
VMNAME="Ubuntu-Cloud-Image"
|
||||||
@@ -10,21 +10,20 @@ VMUSER="username"
|
|||||||
VMPASSWORD="Code24"
|
VMPASSWORD="Code24"
|
||||||
VMSTORAGE="local-lvm"
|
VMSTORAGE="local-lvm"
|
||||||
|
|
||||||
|
|
||||||
echo "Start of NEW VM $VMNAME"
|
echo "Start of NEW VM $VMNAME"
|
||||||
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"
|
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
|
if [ -f /etc/pve/qemu-server/$VMID.conf ]; then
|
||||||
qm destroy $VMID
|
qm destroy $VMID
|
||||||
else
|
else
|
||||||
echo "The $VMID.conf file is not there, ok"
|
echo "The $VMID.conf file is not there, ok"
|
||||||
fi
|
fi
|
||||||
echo "Switches to temporary folder"
|
echo "Switches to temporary folder"
|
||||||
cd /tmp
|
cd /tmp
|
||||||
|
|
||||||
if [ -f $IMGFILENAME ]; then
|
if [ -f $IMGFILENAME ]; then
|
||||||
rm $IMGFILENAME
|
rm $IMGFILENAME
|
||||||
else
|
else
|
||||||
echo "The file is not there, prepare to download"
|
echo "The file is not there, prepare to download"
|
||||||
fi
|
fi
|
||||||
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 --tags $TAGS && qm resize $VMID scsi0 +53G && qm template $VMID
|
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 --tags $TAGS && qm resize $VMID scsi0 +53G && qm template $VMID
|
||||||
cd /root
|
|
||||||
echo "THE NEW $VMNAME VM IS DONE"
|
echo "THE NEW $VMNAME VM IS DONE"
|
||||||
Reference in New Issue
Block a user