TofuLibVirt/vm-infrastructure
John Kenyon 4fbbcb99b2 Add first attempt at libvirt project 2025-09-22 08:26:25 -07:00
..
cloud-init Add first attempt at libvirt project 2025-09-22 08:26:25 -07:00
.terraform.lock.hcl Add first attempt at libvirt project 2025-09-22 08:26:25 -07:00
README.md Add first attempt at libvirt project 2025-09-22 08:26:25 -07:00
main.tf Add first attempt at libvirt project 2025-09-22 08:26:25 -07:00
outputs.tf Add first attempt at libvirt project 2025-09-22 08:26:25 -07:00
variables.tf Add first attempt at libvirt project 2025-09-22 08:26:25 -07:00

README.md

VM Infrastructure with OpenTofu + LibVirt

This project provisions virtual machines using OpenTofu and LibVirt.

Quick Start

# Initialize OpenTofu
tofu init

# Plan deployment
tofu plan

# Deploy VMs
tofu apply

# Get VM IPs
tofu output vm_ips

# Destroy infrastructure when done
tofu destroy

Configuration

  • VMs: 3 Ubuntu 22.04 VMs with 4GB RAM, 2 vCPUs, 30GB disk each
  • Authentication: SSH key-based (no password auth)
  • User: ubuntu with sudo access
  • Network: Default libvirt network with DHCP

Files

  • main.tf - Main infrastructure configuration
  • variables.tf - Input variables
  • outputs.tf - Output values (VM IPs and names)
  • terraform.tfvars - Variable values
  • cloud-init/ - VM initialization configuration

Prerequisites

  1. Install LibVirt and OpenTofu (see main PLAN.md)
  2. Ensure your SSH public key is in cloud-init/user-data.yaml
  3. User must be in libvirt group

Accessing VMs

# SSH to VM (replace with actual IP)
ssh ubuntu@192.168.122.100