Files
infra-automation/inventories/development/libvirt_kvm.yml
Infrastructure Team e7f5c7aea7 Add dynamic inventory configuration
- Add development environment inventory structure
- Configure libvirt/KVM inventory plugin for VM management
- Add grokbox hypervisor host configuration
- Include existing VM hosts (pihole, mymx, derp)
- Set up SSH ProxyJump through grokbox for all VMs
2025-11-10 22:51:17 +01:00

57 lines
1.7 KiB
YAML

---
# =============================================================================
# Libvirt/KVM Dynamic Inventory Configuration
# =============================================================================
# Configuration for libvirt_kvm dynamic inventory plugin
# =============================================================================
plugin: libvirt_kvm
# Hypervisor Connections
# -----------------------------------------------------------------------------
# List of libvirt hypervisors to query
hypervisors:
- name: grokbox
uri: "qemu+ssh://grok@grok.home.serneels.xyz/system"
proxy_jump: true
description: "Primary KVM hypervisor"
# Grouping Configuration
# -----------------------------------------------------------------------------
# Automatically create groups based on VM characteristics
compose:
# Set ansible_host from IP address if available
ansible_host: vm_ip_address | default(omit)
groups:
# Group by VM state
running_vms: vm_state == 'running'
stopped_vms: vm_state != 'running'
# Group by resource allocation
small_vms: vm_memory_mb <= 2048
medium_vms: vm_memory_mb > 2048 and vm_memory_mb <= 8192
large_vms: vm_memory_mb > 8192
# Group by hypervisor
grokbox_guests: hypervisor == 'grokbox'
# Keyed Groups
# -----------------------------------------------------------------------------
# Create dynamic groups based on host variables
keyed_groups:
- key: vm_state
prefix: state
separator: "_"
- key: hypervisor
prefix: hypervisor
separator: "_"
# Filters
# -----------------------------------------------------------------------------
# Only include running VMs by default (can be overridden)
# strict: false
# include_vms:
# - running