Ansible + OpenTofu builder for disposable Fedora VMs with kdump and kernel debuginfo pre-configured. Uses libvirt/KVM.
- Linux host with libvirt/KVM (Fedora, RHEL, or CentOS Stream)
- Ansible (
pip install ansible) - OpenTofu (
tofuin PATH) sshpass(for password-based SSH to the VM)
# Install Ansible dependencies
ansible-galaxy collection install -r requirements.yml
# Create a VM (default: Fedora 44, kdump enabled, debuginfo installed)
ansible-playbook 01-create-vm.yml
# SSH into the VM
~/vm-lab/work/fedora01_login.sh
# Capture a vmcore (inside the VM)
echo c | sudo tee /proc/sysrq-trigger
# After the VM reboots, retrieve the vmcore
scp fedora@<vm-ip>:/var/crash/*/vmcore .
scp fedora@<vm-ip>:/usr/lib/debug/lib/modules/$(ssh fedora@<vm-ip> uname -r)/vmlinux .
# Destroy everything
ansible-playbook 99-destroy-all.ymlEdit vars.yml before running. Key settings:
| Variable | Default | Description |
|---|---|---|
vm_prefix |
fedora01 |
Name prefix for libvirt resources |
vm_os_image |
Fedora 44 Cloud Base | Fedora cloud image URL (38–44 selectable) |
vm_vcpu |
2 |
vCPUs |
vm_memory |
4 |
RAM in GB |
vm_disk_size |
20 |
Disk in GB |
vm_crashkernel |
512M |
crashkernel reservation |
vm_install_debuginfo |
true |
Install kernel debuginfo at build time |
- libvirt storage pool (
vm_prefix) - NAT network with DHCP (
vm_prefix_network) - Fedora Cloud VM with:
- User
fedora/ passwordfedora(sudo NOPASSWD) - kdump enabled with
crashkernel=512M kernel-debuginfoinstalled (vmlinux available)- Serial console + VNC
- User
MIT