1.8 KiB

Role: proxmox_vm

Description

Creates and configures virtual machines on Proxmox VE hypervisor with cloud-init support and automated provisioning.

Requirements

  • Ansible 2.9+
  • Proxmox VE server
  • community.general collection
  • Valid Proxmox credentials in vault

Features

  • Automated VM creation with cloud-init
  • Configurable CPU, memory, and disk resources
  • Network configuration with DHCP or static IP
  • SSH key injection for passwordless access
  • Ubuntu Server template support

Variables

Variable Default Description
vm_memory 8192 RAM allocation in MB
vm_cores 2 Number of CPU cores
vm_disk_size 20G Disk size
vm_iso ubuntu-24.04-live-server-amd64.iso Installation ISO
vm_ciuser master Default cloud-init user
vm_storage local-lvm Proxmox storage backend

Vault Variables (Required)

Variable Description
vault_proxmox_host Proxmox server IP/hostname
vault_proxmox_user Proxmox username (e.g., root@pam)
vault_proxmox_password Proxmox password
vault_vm_cipassword VM default user password
vault_ssh_public_key SSH public key for VM access

Dependencies

  • Proxmox VE server with API access
  • ISO images uploaded to Proxmox storage

Example Playbook

- hosts: localhost
  roles:
    - role: proxmox_vm
      vm_name: "test-vm"
      vm_id: 999
      vm_memory: 4096

Tags

  • proxmox: All Proxmox operations
  • vm: VM creation tasks
  • infrastructure: Infrastructure provisioning

Notes

  • Requires Proxmox API credentials in vault
  • VM IDs must be unique on Proxmox cluster
  • Cloud-init requires compatible ISO images
  • VMs are created but not started by default