Skip to content

Instantly share code, notes, and snippets.

@phillipsj
Last active October 26, 2024 00:54
Show Gist options
  • Save phillipsj/361f30ed593832078494e412575e13a7 to your computer and use it in GitHub Desktop.
Save phillipsj/361f30ed593832078494e412575e13a7 to your computer and use it in GitHub Desktop.
Script for creating cloud image templates for Proxmox VE.
#!/usr/bin/env bash
# Creating Tumbleweed Template
wget https://download.opensuse.org/tumbleweed/appliances/openSUSE-Tumbleweed-JeOS.x86_64-kvm-and-xen.qcow2
qm create 9000 --name tumbleweed --cores 2 --memory 4096 --net0 virtio,bridge=vmbr0
qm importdisk 9000 openSUSE-Tumbleweed-JeOS.x86_64-kvm-and-xen.qcow2 local-lvm
qm set 9000 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9000-disk-0
qm set 9000 --boot c --bootdisk virtio0
qm set 9000 --agent 1
qm set 9000 --vga qxl
qm set 9000 --machine q35
qm resize 9000 scsi0 +10000M
qm template 9000
# Creating Leap Template
wget https://download.opensuse.org/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2
qm create 9001 --name leap --cores 2 --memory 4096 --net0 virtio,bridge=vmbr0
qm importdisk 9001 openSUSE-Leap-15.3-JeOS.x86_64-kvm-and-xen.qcow2 local-lvm
qm set 9001 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9001-disk-0
qm set 9001 --boot c --bootdisk virtio0
qm set 9001 --agent 1
qm set 9001 --vga qxl
qm set 9001 --machine q35
qm resize 9001 scsi0 +10000M
qm template 9001
# Creating MicroOS Template
wget https://download.opensuse.org/tumbleweed/appliances/openSUSE-MicroOS.x86_64-kvm-and-xen.qcow2
qm create 9002 --name microos --cores 2 --memory 4096 --net0 virtio,bridge=vmbr0
qm importdisk 9002 openSUSE-MicroOS.x86_64-kvm-and-xen.qcow2 local-lvm
qm set 9002 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9002-disk-0
qm set 9002 --boot c --bootdisk virtio0
qm set 9002 --agent 1
qm set 9002 --vga qxl
qm set 9002 --machine q35
qm resize 9002 scsi0 +10000M
qm template 9002
# Creating MicroOS Leap Template
wget https://download.opensuse.org/repositories/openSUSE:/Leap:/Micro:/5.1/images/openSUSE-Leap-Micro.x86_64-Default.raw.xz
qm create 9003 --name microleap --cores 2 --memory 4096 --net0 virtio,bridge=vmbr0
unxz openSUSE-Leap-Micro.x86_64-Default.raw.xz
qm importdisk 9003 openSUSE-Leap-Micro.x86_64-Default.raw local-lvm
qm set 9003 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9003-disk-0
qm set 9003 --boot c --bootdisk virtio0
qm set 9003 --agent 1
qm set 9003 --vga qxl
qm set 9003 --machine q35
qm resize 9003 scsi0 +10000M
qm template 9003
# Creating Leap Cloud Init Template
wget https://download.opensuse.org/distribution/leap/15.3/appliances/openSUSE-Leap-15.3-JeOS.x86_64-OpenStack-Cloud.qcow2
qm create 9004 --name leapOpenStack --cores 2 --memory 4096 --net0 virtio,bridge=vmbr0
qm importdisk 9004 openSUSE-Leap-15.3-JeOS.x86_64-OpenStack-Cloud.qcow2 local-lvm
qm set 9004 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9004-disk-0
qm set 9004 --boot c --bootdisk virtio0
qm set 9004 --agent 1
qm set 9004 --vga qxl
qm set 9004 --machine q35
qm set 9004 --serial0 socket # for cloud init
qm resize 9004 scsi0 +10000M
qm template 9004
# Creating Ubuntu Template
wget https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
qm create 9020 --name ubuntu2004 --cores 2 --memory 8192 --net0 virtio,bridge=vmbr0
qm importdisk 9020 focal-server-cloudimg-amd64.img local-lvm
qm set 9020 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9020-disk-0
qm set 9020 --boot c --bootdisk virtio0
qm set 9020 --agent 1
qm set 9020 --vga qxl
qm set 9020 --machine q35
qm set 9020 --serial0 socket # for cloud init
qm resize 9020 scsi0 +10000M
qm template 9020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment