Skip to content
5 min read Updated

Architecting an Enterprise-Grade Homelab: My Ansible Master Playbook

How my Ansible master playbook splits a homelab into tiers: HA DNS on Raspberry Pis, app and management nodes, an isolated DMZ, and dedicated AI hosts.


Disclosure: This post contains Amazon affiliate links (marked with *). As an Amazon Associate I earn from qualifying purchases. Buying through them costs you nothing extra.

Update (2026-09-09): the Atlantis/Cloudflared exposure described in section 3 below is no longer how this runs. Atlantis’s public webhook has since been removed entirely and replaced with a self-hosted GitHub Actions runner that polls outbound instead of accepting inbound PR webhooks, and the public tunnel allowlist has narrowed to exactly two hostnames, neither of them Atlantis. See the Cloudflare Tunnel post for the full timeline. The role-based Ansible structure and the rest of the tiering below (HA DNS core, DMZ isolation, CrowdSec) are still accurate.

Many homelabs start as a single Docker host or a messy Proxmox node where services are spun up by hand. Once the stack grows to reverse proxies, DNS blocklists, network storage, and AI models, manual management stops scaling. Mine runs on physical hardware: a BMAX Mini PC* (64GB RAM, Ryzen 7) for compute and Raspberry Pi 4Bs* for edge DNS.

I run it like a production environment: everything is defined in code, segmented by function, and deployed automatically. The full setup is tracked on the Homelab Infrastructure project page. Below is the Ansible master playbook that ties the tiers together.

View the complete Ansible architecture on GitHub

The Master Playbook: A Tiered Approach

Instead of one monolithic script, my site.yml is an orchestrator. It applies specific roles to specific host groups, so every node gets only the software it needs.

---
- name: Provision Base OS and Docker infrastructure
  hosts: nodes
  become: true
  roles:
    - common
    - docker
    - watchtower
    - monitoring_agent

1. The Foundation (Base OS)

Every node (LXC container, VM, or physical Raspberry Pi) runs through this baseline. It installs core utilities, hardens the OS, installs Docker, and deploys the Prometheus/Telegraf monitoring agents. Watchtower keeps the baseline containers updated automatically.

2. The High-Availability Core (Hardware Isolation)

This is the most important design decision in the lab:

- name: Provision HA Core Services
  hosts: rpi_nodes
  become: true
  roles:
    - rpi_optimize
    - keepalived
    - adguard
    - unbound
    - nginx_proxy_manager

If your primary DNS runs on a Proxmox VM, the whole network loses name resolution every time you reboot the hypervisor for kernel updates. So I moved core networking services to physical Raspberry Pis.

With keepalived, the Pi nodes share a Virtual IP (VIP). If Pi-1 dies, Pi-2 takes over the IP within seconds. They run Unbound (recursive DNS) and AdGuard Home (filtering) on keepalived HA, plus the internal Nginx Proxy Manager. I can shut down the main server entirely and the house WiFi and DNS keep working.

3. Application & Management Tiers

The heavy lifting happens on the main Proxmox cluster, with management tools separated from standard applications.

- name: Provision Management Services
  hosts: mgmt_nodes
  become: true
  roles:
    - pbs # Proxmox Backup Server

- name: Provision Application Services
  hosts: app_nodes
  become: true
  roles:
    - minio
    - vaultwarden
    - mikrodash
    - monitoring_core
    - atlantis
    - cloudflared
    - paperless
    - open_webui

Two roles here shape the workflow:

  • Atlantis gives me a GitOps workflow for Terraform. I open a pull request on GitHub, Atlantis runs terraform plan automatically and posts the result, and an atlantis apply comment applies it.
  • Cloudflared provides Zero Trust ingress without opening ports on my firewall.

4. The DMZ & External Exposure

Services that face the public internet are isolated in a DMZ VLAN, locked down with MikroTik* firewall rules covered in a previous post.

- name: Provision DMZ External Proxy
  hosts: dmz_proxies
  become: true
  roles:
    - nginx_proxy_manager
    - crowdsec_bouncer

- name: Provision DMZ Game Servers
  hosts: dmz_games
  become: true
  roles:
    - minecraft

The external proxy is protected by crowdsec_bouncer. CrowdSec works like a collaborative fail2ban: if an IP is known for attacking other CrowdSec users, my proxy drops the connection before it reaches a login screen.

5. Dedicated Hardware (AI & LLMs)

Resource-heavy workloads like local LLMs get their own provisioning, since they often need specific GPU drivers or hardware passthrough.

- name: Provision AI & LLM Services
  hosts: ai_nodes
  become: true
  roles:
    - ollama

Why Build It This Way

A setup like this is a good DevOps training ground. If you can explain how you built a split-DNS, highly available, Zero Trust environment with Ansible and Terraform, you can talk credibly about enterprise environments, because the same role-based Ansible patterns apply there at larger scale.

Was this helpful?
Share
DW

David Woitzik

Hybrid Cloud Engineer

I work mostly with Azure, Terraform, and Zero-Trust network design, and publish the Terraform templates and write-ups I wanted when I was solving the same problems.

Keep reading

More like this in your inbox

New Terraform modules and articles by email. No spam.