#!/bin/bash # ____ _ _ #/ ___|| |_| |__ ___ _ __ ___ #\___ \| __| '_ \ / _ \| '_ \ / _ \ # ___) | |_| | | | (_) | |_) | __/ #|____/ \__|_| |_|\___/| .__/ \___| # |_| # # Ubuntu Server 22.04 (jammy) distro_url="https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2" filename="proxmox_cloudinit" wget -q "$distro_url" -O "$filename.${file##*.}" file="$filename.${file##*.}" NEXTID=$(pvesh get /cluster/nextid) vm_id=$NEXTID vm_name="Ubuntu" qm create $vm_id --name $vm_name --net0 virtio,bridge=vmbr0 qm importdisk $vm_id $file local-lvm qm set $vm_id --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-$vm_id-disk-0 qm set $vm_id --ide2 local-lvm:cloudinit qm set $vm_id --boot c --bootdisk scsi0 qm set $vm_id --memory 2048 qm set $vm_id --balloon 0 qm set $vm_id --onboot 0 qm set $vm_id --cores 2 qm set $vm_id --tablet 0 qm set $vm_id --agent enabled=1 qm set $vm_id --serial0 socket --vga serial0 qm set $vm_id --ipconfig0 ip=dhcp,ip6=dhcp qm set $vm_id --ciuser test --cipassword test function make_template() { qm template $vm_id }