Browse Source

Re-enable image download, delete temporary files and (basic) test args

pull/1/head
Julien Escario 3 years ago
parent
commit
c6ac06434a
  1. 13
      cloud-init/create_ubuntu20_template.sh

13
cloud-init/create_ubuntu20_template.sh

@ -15,17 +15,26 @@ fi
echo "Storage $_storage is valid and VM does not exists, let's get the latest Ubuntu-minimal image from repo"
# Récupération de l'image Ubuntu
#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
# 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
# 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 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
# Convert VM to template
/usr/sbin/qm template 9999
# Adjust VM settings (based on best practices)
/usr/sbin/qm set 9999 --args "-cpu 'kvm64,+ssse3,+sse4.1,+sse4.2,+x2apic'" --ciuser root --ipconfig0 ip=dhcp,ip6=dhcp --sshkeys support@altinea.fr.pub --name "Ubuntu20.04" --agent enabled=1
# Delete temporary files
rm ubuntu-20.04-minimal-cloudimg-amd64.img
rm support@altinea.fr.pub
echo "All done, you can now clone VM9999 (Ubuntu20.04) from PVE interface"
Loading…
Cancel
Save