Files
ansible_proxmox_VM/defaults/main.yml
Jose d171a4a7b9 refactor ♻️: Refactored all task files to use centralized helper functions from tasks/helpers.yml, improving code consistency, maintainability, and idempotency.
All task files now use centralized helper functions, ensuring idempotency across all stages. Code is cleaner, more maintainable, and no breaking changes were introduced.
2025-11-18 20:24:43 +01:00

178 lines
6.1 KiB
YAML

---
###############################################################################
# Ansible Role: Proxmox Debian VM Template & Clone Manager
# defaults/main.yml - Default variables with comprehensive documentation
###############################################################################
###############################################################################
# BASE VM CONFIGURATION
###############################################################################
# Virtual Machine ID (must be unique, >= 100)
vm_id: 150
# Hostname for the base VM (template)
hostname: debian-template-base
# Memory in MB
memory: 2048
# Number of CPU cores
cores: 2
# CPU type (host, kvm64, x86-64-v2-AES, etc.)
cpu_type: host
# Bridge interface for networking
bridge: vmbr0
# Proxmox storage pool for VM disks
storage: local-lvm
###############################################################################
# MAC ADDRESS GENERATION (avoids collisions)
###############################################################################
# Base MAC address
mac_base: "DE:AD:BE"
# Auto-generate suffix based on VM ID
mac_suffix: "{{ '%02X:%02X' | format((vm_id // 256) % 256, vm_id % 256) }}"
# Full MAC address
mac_address: "{{ mac_base }}:{{ mac_suffix }}"
###############################################################################
# DEBIAN IMAGE CONFIGURATION
###############################################################################
# URL to Debian GenericCloud image
# debian_image_url: "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2
debian_image_url: "https://cloud.debian.org/images/cloud/trixie/latest/debian-13-genericcloud-amd64.qcow2"
# Local path where image is cached
# debian_image_path: "/var/lib/vz/template/qemu/debian-genericcloud-amd64.qcow2"
debian_image_path: "/var/lib/vz/template/qemu/debian-13-genericcloud-amd64.qcow2"
###############################################################################
# NETWORKING CONFIGURATION
###############################################################################
# IP mode: "dhcp" or "static"
ip_mode: dhcp
# Static IP address (CIDR notation, only used if ip_mode: static)
ip_address: "192.168.1.60/24"
# Gateway IP address
gateway: "192.168.1.1"
# DNS nameservers
dns:
- "1.1.1.1"
- "8.8.8.8"
# Proxmox Cloud-Init network configuration
ipconfig0: "{{ 'ip=dhcp' if ip_mode == 'dhcp' else 'ip=' + ip_address + ',gw=' + gateway }}"
###############################################################################
# CLOUD-INIT CONFIGURATION
###############################################################################
# Default Cloud-Init user
ci_user: debian
# Default password for Cloud-Init user
# ⚠️ WARNING: Consider using Ansible Vault or external secrets management
# Example with vault: ci_password: "{{ vault_debian_password }}"
ci_password: "SecurePass123"
# Path to SSH public key (relative to ansible controller)
# This key will be added to authorized_keys for the ci_user
ssh_key_path: "~/.ssh/id_rsa.pub"
# Timezone for the VM
timezone: "Europe/Berlin"
###############################################################################
# PACKAGE MANAGEMENT
###############################################################################
# Packages to install via Cloud-Init
packages:
- qemu-guest-agent # Proxmox guest agent for better VM monitoring
- curl # Command-line HTTP client
- htop # Interactive process viewer
###############################################################################
# DISK CONFIGURATION
###############################################################################
# Enable disk resizing after VM creation
resize_disk: true
# Target disk size (use 'G' for GB, 'T' for TB)
resize_size: "8G"
###############################################################################
# UEFI + TPM 2.0 CONFIGURATION (Advanced)
###############################################################################
# Enable UEFI firmware and TPM 2.0 support
# Required for: Secure Boot, Windows 11, modern security features
enable_tpm: false
###############################################################################
# GPU PASSTHROUGH (Advanced)
###############################################################################
# Enable PCI GPU passthrough
# Requires: IOMMU support in host kernel (intel_iommu or amd_iommu)
gpu_passthrough: false
# PCI device ID of GPU to passthrough (format: DDDD:BB:SS.F)
# Find with: lspci | grep -i gpu
gpu_device: "0000:01:00.0"
# Use VirtIO GPU instead (software GPU emulation)
# Better compatibility, but lower performance than passthrough
virtio_gpu: false
###############################################################################
# TEMPLATE & CLONE CONFIGURATION
###############################################################################
# Convert base VM to a Proxmox template after configuration
# Templates cannot be booted directly but are faster to clone from
make_template: true
# Create clones from the template after conversion
create_clones: true
###############################################################################
# CLONE LIST
###############################################################################
# Each clone inherits the template's configuration and can override:
# id: unique Proxmox VM ID (>= 100, must not already exist)
# hostname: FQDN or hostname for the clone
# ip: IP address with CIDR (e.g., "192.168.1.81/24")
# gateway: Gateway IP for the clone
# full: 1 = full clone (independent, slow), 0 = linked clone (dependent, fast)
clones:
- id: 301
hostname: app01
ip: "192.168.1.81/24"
gateway: "192.168.1.1"
full: 1
- id: 302
hostname: app02
ip: "192.168.1.82/24"
gateway: "192.168.1.1"
full: 0
###############################################################################
# ADVANCED OPTIONS
###############################################################################
# Enable verbose debug output (useful for troubleshooting)
debug_mode: false
# Retry configuration for transient failures
max_retries: 3
retry_delay: 5
# Timeout settings (in seconds)
image_download_timeout: 300
vm_boot_timeout: 60
cloud_init_timeout: 120