initial commit
This commit is contained in:
commit
74412c51a4
9 changed files with 229 additions and 0 deletions
43
create_vm
Executable file
43
create_vm
Executable file
|
@ -0,0 +1,43 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
CPUS=1
|
||||
MEMORY=512
|
||||
BRIDGE=vmbr0
|
||||
STORAGE=customer-disks
|
||||
OS_TYPE=l26
|
||||
DISK_IMAGE=/root/images/debian-12-genericcloud-amd64.qcow2
|
||||
|
||||
ID=$1
|
||||
NAME=$2
|
||||
ORGA=$3
|
||||
|
||||
usage() {
|
||||
printf "usage: %s <id> <name> <organisation>\n" $0
|
||||
}
|
||||
|
||||
[ $# != 3 ] && usage && exit 1
|
||||
|
||||
# create vm
|
||||
qm create "${ID}" \
|
||||
--cpu x86-64-v3 \
|
||||
--cores ${CPUS} \
|
||||
--memory ${MEMORY} \
|
||||
--name "${NAME}" \
|
||||
--net0 "bridge=${BRIDGE},model=virtio,tag=${ID}" \
|
||||
--onboot 1 \
|
||||
--ostype ${OS_TYPE} \
|
||||
--pool "${ORGA}" \
|
||||
--scsihw virtio-scsi-pci \
|
||||
--sata0 media=cdrom,file=none \
|
||||
--ide2 ${STORAGE}:cloudinit
|
||||
|
||||
# import debian cloud image
|
||||
qm set ${ID} --virtio0 ${STORAGE}:0,import-from=${DISK_IMAGE}
|
||||
|
||||
# resize imported disk to 50GB
|
||||
qm disk resize ${ID} virtio0 50G
|
||||
|
||||
# change boot device to debian cloud image
|
||||
qm set ${ID} --boot order=virtio0
|
Loading…
Add table
Add a link
Reference in a new issue