Skip to content
homelab-iac logo

Homelab Infrastructure as Code

homelab-iac

Use when working with Proxmox homelab infrastructure - Terraform provisioning, Ansible configuration, or Nix devshells. Covers LXC containers, services, secrets, and IaC workflows.

SKILL.md

Full skill instructions

Homelab Infrastructure as Code

Overview

This is a Proxmox homelab managed as Infrastructure as Code. All changes go through Terraform or Ansible. SSH is read-only for debugging.

Change TypeTool
Container specs (CPU, memory, disk, mounts)Terraform
Software, packages, config files, servicesAnsible
Development environmentNix devshells

Quick Reference

Containers

CTIDHostIPPurpose
300backup.120Restic backups
301samba.121SMB shares
302ripper.131MakeMKV (optical drive)
303analyzer.133FileBot, media tools
304transcoder.132FFmpeg (Intel Arc GPU)
305jellyfin.130Media server (dual GPU)
310dns.110AdGuard Home
311proxy.111Caddy reverse proxy
320devbox.140NixOS dev environment

SSH: Use aliases from ~/​.ssh/​config (e.g., ssh ripper, ssh jellyfin).

Directory Structure

terraform/
  proxmox-homelab/   # LXC containers (one .tf per container)
  tailscale/         # VPN configuration
  cloudflare/        # DNS records
  lldap/             # LDAP users/​groups

ansible/
  playbooks/         # Service playbooks
  roles/             # Reusable roles
  vars/​*_secrets.yml # Vault-encrypted secrets

nixos/               # Devbox NixOS config
flake.nix            # Nix devshells

Secrets

TypeLocationEdit Command
Terraformterraform/​*/​secrets.sops.yamlsops <file>
Ansibleansible/​vars/​*_secrets.ymlansible-vault edit <file>

Terraform Workflow

Always: plan → review → apply → verify

cd terraform/<module>
terraform fmt
terraform validate
terraform plan          # REQUIRED before apply

Present plan summary to user. Ask: "Does this look correct?"

After approval:

terraform apply

Verify resources exist, update docs/​reference/​current-state.md if needed.

Ansible Workflow

Always: lint → check → apply → verify

cd ansible
ansible-lint --offline
ansible-playbook playbooks/<service>.yml --syntax-check
ansible-playbook playbooks/<service>.yml --check   # REQUIRED dry-run

Present changes to user. Ask: "Does this look correct?"

After approval:

ansible-playbook playbooks/<service>.yml

Long-running playbooks (jellyfin, transcoder, proxmox-host): Use 600000ms timeout.

Verify via SSH: systemctl status <service>, journalctl -u <service>.

Nix DevShells

All commands require the devshell. Verify with which terraform.

direnv allow    # Auto-load (recommended)
nix develop     # Manual entry

If tools are missing, the devshell isn't loaded. See root CLAUDE.md for troubleshooting.

Adding a New Container

This is a multi-step workflow. See add-container.md for the complete checklist.

Quick overview:

  1. Create terraform/​proxmox-homelab/<name>.tf
  2. Run Terraform workflow (plan → apply)
  3. Add to Ansible inventory
  4. Create playbook and roles
  5. Run Ansible workflow (check → apply)
  6. Update documentation

Common Operations

Scale Container Resources

Edit CPU/​memory in terraform/​proxmox-homelab/<name>.tf, run Terraform workflow.

Add Ansible Role to Existing Container

  1. Create ansible/​roles/<name>/ with tasks/​handlers/​templates
  2. Add role to playbook
  3. Run Ansible workflow

GPU Passthrough

Requires coordination:

  • Terraform: Container privileged, features.nesting=true
  • Ansible: GPU passthrough role delegates to Proxmox host

See jellyfin.tf and dual_gpu_passthrough role for patterns.

Backup Operations

# On backup container
restic snapshots
restic restore <snapshot-id> --target /​restore

Safety Protocols

Never Do

  • Apply Terraform/​Ansible without dry-run first
  • Skip user approval for any changes
  • Edit terraform.tfstate manually
  • Commit .tfstate files or unencrypted secrets
  • Run apt, systemctl, or edit files via SSH (use IaC instead)
  • Delete or modify infrastructure without understanding dependencies

Always Do

  • Read current-state.md before making changes
  • Present plan/​check output before applying
  • Verify changes after applying (SSH, service status, logs)
  • Commit changes including documentation updates
  • Use SOPS/​Vault for secrets, never plaintext

Git Discipline

  • Never skip pre-commit hooks
  • Commit Terraform and Ansible changes separately
  • Update current-state.md when infrastructure changes

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View