Initial Commit

This commit is contained in:
2023-07-26 05:21:42 +02:00
parent 1546e05b99
commit 7a197e3841
4 changed files with 131 additions and 24 deletions

View File

@ -5,8 +5,6 @@
# ___) | |_| | | | (_) | |_) | __/
#|____/ \__|_| |_|\___/| .__/ \___|
# |_|
#
clear
# Ubuntu Server 22.04 (jammy)
@ -20,27 +18,28 @@ NEXTID=$(pvesh get /cluster/nextid)
vm_id=$NEXTID
vm_name="ubuntu"
vm_ram=2048
vm_core=2
username="admin"
password=admin
ip4="dhcp"
ip6="dhcp"
balloon=0
onboot=0
tablet=0
agent_enabled=1
hdd_size=10
qm create $vm_id --memory 2048 --core 2 --name $vm_name --net0 virtio,bridge=vmbr0 >/dev/null
qm create $vm_id --name $vm_name --memory $vm_ram --core $vm_core --net0 virtio,bridge=vmbr0 >/dev/null
qm importdisk $vm_id $file local-lvm >/dev/null
qm set $vm_id --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-$vm_id-disk-0 >/dev/null
qm set $vm_id --ide2 local-lvm:cloudinit >/dev/null
qm set $vm_id --boot c --bootdisk scsi0 >/dev/null
qm set $vm_id --serial0 socket --vga serial0 >/dev/null
qm set $vm_id --balloon 0 >/dev/null
qm set $vm_id --onboot 0 >/dev/null
qm set $vm_id --tablet 0 >/dev/null
qm set $vm_id --agent enabled=1 >/dev/null
qm set $vm_id --ipconfig0 ip=dhcp,ip6=dhcp >/dev/null
qm set $vm_id --ciuser test --cipassword test >/dev/null
# Create a Template
function make_template() {
qm template $vm_id >/dev/null
}
# Clone the Template
function clone_template() {
qm clone $vm_id $vm_cloned_id --name $vm_cloned_name --full >/dev/null
}
qm set $vm_id --balloon $balloon >/dev/null
qm set $vm_id --onboot $onboot >/dev/null
qm set $vm_id --tablet $tablet >/dev/null
qm set $vm_id --agent enabled=$agent_enabled >/dev/null
qm set $vm_id --ipconfig0 ip=$ip4,ip6=$ip6 >/dev/null
#qm set $vm_id --ciuser "$username" --cipassword "$password" >/dev/null
qm resize $vm_id scsi0 +"$hdd_size"G >/dev/null