#!/bin/bash # ____ _ _ #/ ___|| |_| |__ ___ _ __ ___ #\___ \| __| '_ \ / _ \| '_ \ / _ \ # ___) | |_| | | | (_) | |_) | __/ #|____/ \__|_| |_|\___/| .__/ \___| # |_| clear # Ubuntu Server 22.04 (jammy) distro_url="https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img" filename="proxmox_cloudinit" wget -q "$distro_url" -O "$filename.${file##*.}" file="$filename.${file##*.}" 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 --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 $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