Remove static hosts.yml inventory file and configure pure dynamic inventory discovery using community.libvirt.libvirt plugin. Changes: 1. Removed Static Inventory: - Deleted inventories/development/hosts.yml - All host definitions now come from libvirt dynamic discovery - Complies with CLAUDE.md requirement for dynamic inventories 2. Updated libvirt_kvm.yml Dynamic Inventory: - Changed URI from local to remote: qemu+ssh://grok@grok.home.serneels.xyz/system - Configures automatic VM discovery from grokbox hypervisor - Creates dynamic groups: kvm_guests, running_vms, small_vms, large_vms - Creates keyed groups by state and OS - Extracts IP addresses from guest_info 3. Created Host Variables Override: - inventories/development/host_vars/pihole.yml - inventories/development/host_vars/mymx.yml - inventories/development/host_vars/derp.yml - Override ansible_connection from libvirt_qemu to ssh - Set ansible_host to IP addresses (192.168.122.x) 4. Updated Group Variables: - inventories/development/group_vars/kvm_guests.yml - Added ansible_connection: ssh to force SSH over libvirt - Maintains ProxyJump configuration through grokbox - SSH connection multiplexing settings preserved 5. Added .gitignore: - Exclude stats/ directory from version control - Prevents system_info role output from being committed Dynamic Inventory Discovery: - Automatically discovers VMs: pihole, mymx, derp - Groups by state: running_vms, stopped_vms - Groups by size: small_vms (≤2GB), medium_vms (2-8GB), large_vms (>8GB) - Groups by OS: os_debian, os_unknown - Creates UUID-based groups for unique identification Connection Method: - Discovery: libvirt plugin queries grokbox via SSH - Execution: SSH with ProxyJump through grokbox - Authentication: SSH keys (ansible user) - Network: Private 192.168.122.0/24 via NAT Testing Results: ✅ Dynamic inventory discovers all 3 VMs ✅ Groups created correctly (kvm_guests, running_vms, etc.) ✅ pihole: Connection successful via ProxyJump ⚠️ mymx, derp: SSH key authentication needed (not inventory issue) Benefits: - No manual inventory maintenance required - VMs automatically added/removed based on libvirt state - Dynamic grouping by resource allocation - Centralized management through grokbox - CLAUDE.md compliant (no static inventories in production-like envs) Usage: # List all discovered VMs ansible-inventory -i inventories/development/ --graph # Ping all KVM guests ansible -i inventories/development/ kvm_guests -m ping # Run playbook on running VMs ansible-playbook -i inventories/development/ site.yml --limit running_vms Migration Note: The static inventory (hosts.yml) contained some hosts not managed by libvirt (odin, seed). These external hosts need to be managed via separate dynamic inventory sources or added back if required. Related Documentation: - docs/network-access-patterns.md (ProxyJump configuration) - inventories/production/README.md (dynamic inventory examples) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
40 lines
355 B
Plaintext
40 lines
355 B
Plaintext
# Ansible
|
|
*.retry
|
|
*.log
|
|
.vault_pass
|
|
.vault_password
|
|
|
|
# Python
|
|
__pycache__/
|
|
*.py[cod]
|
|
*$py.class
|
|
*.so
|
|
.Python
|
|
venv/
|
|
ENV/
|
|
|
|
# Temporary files
|
|
*.swp
|
|
*.swo
|
|
*~
|
|
.DS_Store
|
|
|
|
# Ansible fact cache
|
|
/tmp/ansible_fact_cache/
|
|
|
|
# Sensitive data
|
|
vault.yml
|
|
secrets.yml
|
|
credentials.yml
|
|
|
|
# IDE
|
|
.vscode/
|
|
.idea/
|
|
*.iml
|
|
|
|
# Test artifacts
|
|
.pytest_cache/
|
|
.coverage
|
|
htmlcov/
|
|
stats/
|