Skip to main content

On This Page

Automating Proxmox VM Provisioning with Ubuntu NoCloud Templates

2 min read
Share

These articles are AI-generated summaries. Please check the original sources for full details.

Provision Ubuntu VMs with NoCloud on Proxmox

Proxmox users can automate the deployment of Ubuntu 24.04 Cloud Images using the NoCloud datasource to inject configurations. This method eliminates manual setup by pre-configuring SSH keys, the QEMU guest agent, and system packages through cloud-init.

Why This Matters

Manual VM configuration creates ‘snowflake’ servers that are difficult to replicate or scale, leading to configuration drift in homelabs and production environments. Utilizing NoCloud with Proxmox CLI allows engineers to move from manual ISO installations to immutable, template-based provisioning that ensures consistent identity and security across all virtual instances.

Key Insights

  • Ubuntu 24.04 Cloud Images (2026) support the NoCloud datasource for local metadata and user-data injection.
  • The QEMU guest agent must be explicitly enabled via ‘qm set’ to allow Proxmox to monitor the VM’s internal state.
  • The ‘cloud-localds’ utility, part of cloud-image-utils, transforms text configurations into an ISO format compatible with Proxmox virtual drives.
  • Cloud-init ‘user-data’ files handle complex logic like package updates, shell assignments, and passwordless sudo configurations.
  • Cloning from a template (qm clone) allows for rapid customization of memory and CPU cores without re-installing the OS.

Working Examples

Initial VM creation and Ubuntu cloud image disk import via Proxmox CLI.

qm create 501 --name ubuntu-cloud-init-template --memory 2048 --cores 2 --net0 virtio,bridge=vmbr0 && qm importdisk 501 /var/lib/vz/template/iso/ubuntu-24.04-server-cloudimg-amd64.img local-zfs && qm set 501 --scsihw virtio-scsi-pci --scsi0 local-zfs:vm-501-disk-0 --boot c --bootdisk scsi0 --agent enabled=1

User-data configuration for cloud-init to automate user creation and agent installation.

#cloud-config
hostname: ubuntu-template
users:
  - name: ubuntu
    ssh-authorized-keys:
      - [ssh-public-key]
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
package_update: true
package_upgrade: true
packages:
  - qemu-guest-agent
runcmd:
  - systemctl enable qemu-guest-agent
  - systemctl start qemu-guest-agent

Practical Applications

  • Use Case: Rapidly scaling dev environments by cloning ID 501 templates to new IDs via ‘qm clone’. Pitfall: Forgetting to update unique hostnames in ~/.ssh/config, resulting in SSH connection conflicts.
  • Use Case: Automated security patching on first boot using ‘package_upgrade: true’ in user-data. Pitfall: High resource contention if multiple VMs start and trigger ‘apt upgrade’ simultaneously.
  • Use Case: Hands-off provisioning of test environments with pre-injected SSH keys. Pitfall: Using the same instance-id in meta-data for all clones, which can confuse cloud-init on some distributions.

References:

Continue reading

Next article

AutoKernel: Automating GPU Kernel Optimization with LLM Agent Loops

Related Content