|
|
@ -25,16 +25,17 @@ fi |
|
|
|
echo "Storage $_storage is valid and VM does not exists, let's get the latest Ubuntu-minimal image from repo" |
|
|
|
|
|
|
|
# Fetching the last Ubuntu Minimal 20.04 cloud-image |
|
|
|
curl --progress-bar -o ubuntu-20.04-minimal-cloudimg-amd64.img https://cloud-images.ubuntu.com/minimal/releases/focal/release/ubuntu-20.04-minimal-cloudimg-amd64.img |
|
|
|
curl --progress-bar -o ubuntu-20.04-server-cloudimg-amd64.img http://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64.img |
|
|
|
|
|
|
|
# Silently download public SSH key |
|
|
|
curl -s -o support@altinea.fr.pub https://gitlab.altinea.fr/altinea/install-scripts/raw/branch/master/ssh/support@altinea.fr.pub |
|
|
|
|
|
|
|
# Create VM, import cloud-image and configure storage |
|
|
|
/usr/sbin/qm create 9999 --memory 1024 --net0 virtio,bridge=vmbr0 |
|
|
|
/usr/sbin/qm importdisk 9999 ubuntu-20.04-minimal-cloudimg-amd64.img $_storage |
|
|
|
/usr/sbin/qm importdisk 9999 ubuntu-20.04-server-cloudimg-amd64.img $_storage |
|
|
|
/usr/sbin/qm set 9999 --scsihw virtio-scsi-pci --scsi0 $_storage:vm-9999-disk-0,discard=on |
|
|
|
/usr/sbin/qm set 9999 --ide2 $_storage:cloudinit --boot c --bootdisk scsi0 --serial0 socket --vga serial0 |
|
|
|
/usr/sbin/qm resize 9999 scsi0 +2748M |
|
|
|
|
|
|
|
# Convert VM to template |
|
|
|
/usr/sbin/qm template 9999 |
|
|
|