If it's running, it's in version control.

The full software stack: IaC, agent runtime, security monitoring, identity management, and automated delivery.

By · Last updated November 19, 2026

Every VM, container, firewall rule and DNS record in our homelab is defined in Terraform and Ansible and kept in git. Changes are reviewed before they run, secrets live in a dedicated secrets manager, and an internal certificate authority issues TLS for internal services. The whole lab can be rebuilt from a fresh hypervisor install and the repo.

Infrastructure as Code

Every VM, container, firewall rule, and DNS record is defined in Ansible playbooks and Terraform configs. Nothing is clicked into existence manually.

Changes go through version control. Rollbacks are a git revert, not a prayer. The entire infrastructure can be rebuilt from a fresh Proxmox install and a repo clone.

What runs the AI agents?

Ollama

Local LLM hosting — models run on our GPU, not a third-party API. Latency measured in milliseconds, cost measured in watts.

LangGraph

Agent orchestration — stateful, graph-based workflows that chain reasoning steps with tool calls and human-in-the-loop gates.

PostgreSQL + pgvector

Persistent memory — structured data and vector embeddings in one database. Agents remember, retrieve, and reason over context.

Security & Monitoring

Monitoring tools, each watching a different surface. The seven layers of defense are on the Cyber page, and how we use these day to day is on the Blue Team page.

Wazuh

SIEM + host-based intrusion detection across every node.

CrowdSec

Collaborative threat intelligence and IP reputation scoring.

Greenbone / OpenVAS

Continuous vulnerability scanning against every exposed surface.

Prometheus + Grafana

Metrics collection, dashboards, and alerting for every service.

Uptime Kuma / netdata

Real-time uptime monitoring and system-level performance tracking.

Testing Our Own Defenses

We test only our own infrastructure, under the written rules on our Scope & RoE page. People run every active check, by hand, after a human approval gate. AI helps only on the defensive side: triaging findings, mapping them to MITRE ATT&CK and drafting detections and fixes. Our AI use is limited to Anthropic’s Cyber Verification Program, Defense Access tier. More on Cyber and the Blue Team page.

How are secrets and certificates handled?

Machine secrets live in a secrets manager, and team credentials in a separate password vault, with an off-premises copy and an offline break-glass copy kept apart from each other. The tiers are described on N+2 & Backup.

A private certificate authority issues TLS for our internal services (see private PKI with offline root keys). Certificates renew automatically, and monitoring flags any that don't.

Secrets manager

Machine secrets for services and automation

Team password vault

Day-to-day credentials for people

Private CA

Internal TLS · Automatic renewal

How does a change reach production?

Infrastructure changes go through the AI-Logos pipeline: an author, two peer reviews on the exact commit (see quorum math), then an automatic backup, a dry run in check mode without printing diffs so secrets never reach the logs, a one-host-at-a-time deploy, health checks and an automatic restore if a check fails. Through the same quorum, agents can create VMs and containers, change infrastructure and update Terraform, always with a backup, a dry run and rollback. Destructive data operations still need a human.

AI-Logos 11-step review loop: author, two cross-provider peer reviews, 3-vote quorum, dry-run, deploy, auto-restore.
Every change goes from task to deploy through a three-vote quorum, and no agent ever merges its own work.

A real, non-obvious lesson

Our own Postgres cluster is SQL_ASCII-encoded, not UTF8 — a legacy of how it was first initialized, not a deliberate choice. It never caused a problem until an agent's drafted marketing copy, containing real non-ASCII characters, tried to write itself into a JSONB audit column.

The root cause: JSON-encoding that text with ensure_ascii=True (Python's own default) turns every non-ASCII character into a \uXXXX escape sequence — and Postgres's JSONB parser has to decode those escapes back into real Unicode codepoints, which needs a UTF8 conversion a SQL_ASCII cluster can't do. The write failed outright.

The fix was one flag — ensure_ascii=False, so the real UTF-8 bytes get written directly instead of escape-encoded. Confirmed with a direct test against the raw connection before trusting it fixed. The database itself is still SQL_ASCII — a known, accepted oddity, not something this one fix changed.

The IaC upgrade path

From hand-built to code-defined, in the order it happened.

  1. Terraform scaffolding for the cluster

    Provisioning moved to a dedicated, least-privilege API token that can create and snapshot guests but cannot touch users, realms or host configuration.

  2. First real Ansible baseline run

    A common baseline applied across the fleet, with check mode first and the live state audited afterwards.

  3. Private CA, password vault, then secrets manager

    An internal certificate authority, a self-hosted vault for people and a secrets manager for infrastructure, with a rotation-sync design between them.

  4. Vulnerability scanning and alert automation as code

    A scanner and a chat-alert workflow added through the same Terraform and Ansible path, bugs and all, written up as they were fixed.

  5. Zero-trust access and tiered vaults

    Tag-based default-deny access rules and a multi-tier secrets recovery plan, including an offline copy.

Read the build-by-build write-ups: least-privilege Terraform, tuning the vulnerability scanner, chat-first alerts, zero trust before going public, fleet-wide observability and a security stack in a night. The hardware it runs on is on Hardware, and the self-healing layer is Hydra.

Frequently asked questions

What is infrastructure as code in this homelab?
Every VM, container, firewall rule and DNS record is described in Terraform and Ansible files kept in git, so the lab’s state can be reviewed, repeated and rebuilt instead of clicked into existence by hand.
Why Terraform and Ansible together?
Terraform creates the guests, using a least-privilege API token that can create and snapshot them but cannot touch users, realms or host configuration. Ansible then configures what Terraform created. Both were set up on August 8, 2026.
Can the whole lab really be rebuilt from git?
The infrastructure can, starting from a fresh hypervisor install and a clone of the repo. What still needs a person is restoring data from backup and unlocking the secrets manager. See N+2 & Backup for the recovery order.
How does a change reach production?
Infrastructure changes go through the AI-Logos pipeline: an author, two peer reviews on the exact commit, then an automatic backup, a dry run, a one-host-at-a-time deploy, health checks and an automatic restore if a check fails. Through the same quorum, agents can create VMs and containers, change infrastructure and update Terraform. Destructive data operations always need a person.
Where do the AI agents run?
On local models running on our own GPUs, with an orchestration layer and a database for memory, all inside the lab.
How are secrets kept out of the repo?
Machine secrets live in a secrets manager and team credentials in a separate password vault, with an off-premises copy and an offline break-glass copy kept apart from each other. None of that material is stored in git.
What went wrong along the way?
Our Postgres cluster uses a legacy character encoding, and an agent’s drafted copy with non-ASCII characters failed to save because the JSON encoder turned each character into an escape sequence. One flag fixed it; the lesson is on this page.

Glossary

Infrastructure as code:
Describing servers, networks and settings in files that are versioned and reviewed like software.
Idempotent:
Safe to run again: running the same configuration twice leaves the same result.
Dry run:
A check-mode run that shows what would change without changing anything.
Least-privilege token:
An API token that can do only the few things its job needs.
Private certificate authority:
Our own certificate issuer that signs TLS certificates for internal services.
Secrets manager:
A dedicated system that stores machine credentials and hands them to services when needed.
Break-glass copy:
An offline emergency copy of access material, used only when everything else is out of reach.

Who built this: .

Follow the build

Questions about the build, or spotted something we got wrong? Find us on LinkedIn and GitHub.