Skip to main content

Terraform + Ansible for a Home Lab

Infrastructure
Provision with Terraform, configure with Ansible - the split that keeps a Proxmox home lab reproducible instead of a pile of hand-clicked VMs.
Author

Benedict Thekkel

Published

February 20, 2026

A home lab rots the moment it becomes un-reproducible. The fix is the same as at work: Terraform provisions the infra, Ansible configures it. Two tools, one clean seam. Built out across Terraform and Ansible in Web_development, running on Proxmox from Software_Tools.

Two tools, one seam

Terraform Ansible
Job Provision (create VMs, networks, storage) Configure (packages, services, files)
Model Declarative desired-state Declarative-ish, procedural playbooks
State Tracks a state file Stateless; idempotent tasks
Idempotent Yes (plan/apply) Yes (per task)
Best at “What exists” “How it’s set up”

The seam: Terraform stops once a VM boots with an IP; Ansible takes over from the IP. Don’t make Terraform install packages, and don’t make Ansible create VMs.

The workflow

The Git repo of Terraform code and playbooks drives terraform plan and apply to create Proxmox VMs, whose dynamic inventory feeds ansible-playbook to produce configured services.

The lab it builds

The Proxmox host runs a Docker host VM with containers, a k3s node VM, and an LXC services container with Postgres and Influx.

Why bother: hands-on minutes to rebuild

The payoff is disaster recovery. Rebuilding by hand is an afternoon; rebuilding from code is a coffee.

Takeaway

Keep the seam clean and the whole lab lives in git: terraform apply then ansible-playbook rebuilds everything from bare Proxmox. Details in Terraform and Ansible.


Back to top