Commit 17a82324 authored by Wen Wei Li's avatar Wen Wei Li

add ubuntu18 cloudinti

parent f7266399
......@@ -2,6 +2,6 @@
### Usage
* `./create-template.sh {VM_ID}`
* `./create-template.sh {Ubuntu Version(18 or 22)}{VM_ID}`
* Note that the VM_ID should not be repeated with other template even in other nodes.
\ No newline at end of file
* Note that the VM_ID should not be repeated with other template even in other nodes.
......@@ -2,7 +2,7 @@
# get the cloudinit ubuntu 22.04 img
ubuntu_22="https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img"
ubuntu_18="https://cloud-images.ubuntu.com/minimal/releases/bionic/release-20230602/ubuntu-18.04-minimal-cloudimg-amd64.img"
ubuntu_18="https://cloud-images.ubuntu.com/minimal/releases/bionic/release/ubuntu-18.04-minimal-cloudimg-amd64.img"
if [[ $1 == '18' ]]; then
echo $ubuntu_18
eval "wget $ubuntu_18"
......@@ -10,20 +10,26 @@ if [[ $1 == '18' ]]; then
elif [[ $1 == '22' ]]; then
eval "wget $ubuntu_22"
mv ubuntu-22.04-minimal-cloudimg-amd64.img ubuntu.img
else
echo "No such version support"
return 1
fi
# Install libguestfs-tools on Proxmox server.
#apt-get install libguestfs-tools -y
apt-get install libguestfs-tools -y
# Install qemu-guest-agent on Ubuntu image.
#virt-customize -a ubuntu.img --install qemu-guest-agent
virt-customize -a ubuntu.img --install qemu-guest-agent
# to let vm will not get same ip address if using dhcp
#virt-customize -a ubuntu.img --run-command "echo -n > /etc/machine-id"
virt-customize -a ubuntu.img --run-command "echo -n > /etc/machine-id"
export STORAGE_POOL=local-lvm
export VM_ID=$1
export VM_NAME=ubuntu-22.04-cloudinit
export VM_ID=$2
if [[ $1 == '18' ]]; then
export VM_NAME='ubuntu-18.04-cloudinit'
elif [[ $1 == '22' ]]; then
export VM_NAME='ubuntu-22.04-cloudinit'
fi
# Create Proxmox VM image from Ubuntu Cloud Image.
qm create $VM_ID --name $VM_NAME --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0
qm importdisk $VM_ID ubuntu.img $STORAGE_POOL
......@@ -34,3 +40,4 @@ qm set $VM_ID --boot c --bootdisk scsi0
qm set $VM_ID --serial0 socket --vga serial0
qm set $VM_ID --agent enabled=1
qm template $VM_ID
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment