infra/clusters/vntx/setup-ubuntu-template.sh
2025-09-06 10:55:13 -05:00

40 lines
No EOL
1,021 B
Bash
Executable file

#!/bin/bash
# Script to create Ubuntu cloud-init template on Proxmox
echo "This script will create an Ubuntu 22.04 cloud-init template on your Proxmox host"
echo "Run this on your Proxmox host (10.0.0.1)"
echo
echo "Commands to run:"
echo
cat << 'EOF'
# Download Ubuntu 22.04 cloud image
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
# Create a new VM
qm create 9000 --name ubuntu-cloud --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0
# Import the downloaded disk to the VM
qm importdisk 9000 jammy-server-cloudimg-amd64.img local-lvm
# Attach the disk to the VM
qm set 9000 --scsihw virtio-scsi-pci --scsi0 local-lvm:vm-9000-disk-0
# Set boot disk
qm set 9000 --boot c --bootdisk scsi0
# Add cloud-init drive
qm set 9000 --ide2 local-lvm:cloudinit
# Configure serial console
qm set 9000 --serial0 socket --vga serial0
# Enable QEMU agent
qm set 9000 --agent enabled=1
# Convert to template
qm template 9000
echo "Template created! VM ID 9000 named 'ubuntu-cloud'"
EOF