Shell-Scripts/Proxmox/cloud-init-agent.sh

24 lines
827 B
Bash

# installing libguestfs-tools only required once, prior to first run
apt update -y
apt install libguestfs-tools -y
VMID=9002
IMAGE=lunar-server-cloudimg-amd64.img
# remove existing image in case last execution did not complete successfully
rm *-server-cloudimg-amd64.img
wget http://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
virt-customize -a $IMAGE --install qemu-guest-agent rsyslog
qm create 9002 --name "ubuntu-k3s-agent-template" --memory 2048 --cores 2 --net0 virtio,bridge=vmbr1
qm importdisk 9002 noble-server-cloudimg-amd64.img local-zfs
qm set 9002 --scsihw virtio-scsi-pci --scsi0 local-zfs:vm-9002-disk-0
qm set 9002 --boot c --bootdisk scsi0
qm set 9002 --ide2 local-zfs:cloudinit
qm set 9002 --serial0 socket --vga serial0
qm set 9002 --agent enabled=1
qm template 9002
rm $IMAGE