|
|
||
|---|---|---|
| .. | ||
| cloud-init | ||
| .terraform.lock.hcl | ||
| README.md | ||
| main.tf | ||
| outputs.tf | ||
| variables.tf | ||
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:
ubuntuwith sudo access - Network: Default libvirt network with DHCP
Files
main.tf- Main infrastructure configurationvariables.tf- Input variablesoutputs.tf- Output values (VM IPs and names)terraform.tfvars- Variable valuescloud-init/- VM initialization configuration
Prerequisites
- Install LibVirt and OpenTofu (see main PLAN.md)
- Ensure your SSH public key is in
cloud-init/user-data.yaml - User must be in
libvirtgroup
Accessing VMs
# SSH to VM (replace with actual IP)
ssh ubuntu@192.168.122.100