feat: Implement Debian VM template creation and cloning on Proxmox
- Added default configuration for VM creation in defaults/main.yml. - Created tasks for configuring the VM with UEFI, TPM, disks, GPU, and Cloud-Init in tasks/configure-vm.yml. - Implemented clone creation and configuration logic in tasks/create-clones.yml. - Added template conversion functionality in tasks/create-template.yml. - Developed base VM creation logic in tasks/create-vm.yml. - Included image download and caching tasks in tasks/download-image.yml. - Introduced utility tasks for common operations in tasks/helpers.yml. - Organized main orchestration logic in tasks/main.yml, with clear stages for each operation. - Added pre-flight checks to validate the environment before execution in tasks/preflight-checks.yml.
This commit is contained in:
79
defaults/main.yml.orig2
Normal file
79
defaults/main.yml.orig2
Normal file
@@ -0,0 +1,79 @@
|
||||
---
|
||||
vm_id: 150
|
||||
hostname: debian-template-base
|
||||
|
||||
memory: 4096
|
||||
cores: 4
|
||||
bridge: vmbr0
|
||||
storage: local-lvm
|
||||
cpu_type: host
|
||||
|
||||
# Default MAC generator: avoids collisions
|
||||
mac_base: "DE:AD:BE"
|
||||
mac_suffix: "{{ '%02X:%02X' | format((vm_id // 256) % 256, vm_id % 256) }}"
|
||||
mac_address: "{{ mac_base }}:{{ mac_suffix }}"
|
||||
|
||||
###############
|
||||
# Networking
|
||||
###############
|
||||
ip_mode: dhcp # or static
|
||||
ip_address: "192.168.1.60/24"
|
||||
gateway: "192.168.1.1"
|
||||
dns:
|
||||
- "1.1.1.1"
|
||||
- "8.8.8.8"
|
||||
|
||||
ipconfig0: "{{ 'ip=dhcp' if ip_mode == 'dhcp' else 'ip=' + ip_address + ',gw=' + gateway }}"
|
||||
|
||||
###############
|
||||
# Packages
|
||||
###############
|
||||
packages:
|
||||
- qemu-guest-agent
|
||||
- curl
|
||||
- htop
|
||||
|
||||
###############
|
||||
# Cloud-Init user + SSH + password
|
||||
###############
|
||||
ci_user: debian
|
||||
ci_password: "SecurePass123" # consider vault
|
||||
ssh_key_path: "~/.ssh/id_rsa.pub"
|
||||
timezone: "Europe/Berlin"
|
||||
|
||||
###############
|
||||
# Optional Disk Resize
|
||||
###############
|
||||
resize_disk: true
|
||||
resize_size: "16G"
|
||||
|
||||
###############
|
||||
# GPU Options
|
||||
###############
|
||||
gpu_passthrough: false
|
||||
gpu_device: "0000:01:00.0"
|
||||
virtio_gpu: false
|
||||
|
||||
###############
|
||||
# TPM + Secure Boot
|
||||
###############
|
||||
enable_tpm: false
|
||||
|
||||
# Convert VM to template?
|
||||
make_template: true
|
||||
|
||||
# Create clones from the template?
|
||||
create_clones: true
|
||||
|
||||
# List of clones
|
||||
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
|
||||
Reference in New Issue
Block a user