Homelab Zen with Ansible and GitLab: Automating the Chaos

Homelab Zen with Ansible and GitLab: Automating the Chaos
Photo by Levi XU / Unsplash

If you've ever found yourself SSHing into five different machines just to run updates—or worse, forgetting which Raspberry Pi is running what—you're not alone. A homelab has a funny way of growing from a weekend experiment into a full-blown infrastructure jungle. At some point, you realize you're spending more time maintaining it than actually using it.

That’s where configuration management comes in. I’ve tamed my homelab with a combination of Ansible, AWX, and a self-hosted GitLab repo. Together, they’ve turned what used to be a mess of manually managed VMs, containers, and bare-metal boxes into a neatly orchestrated setup that (mostly) runs itself.

In this post, I’ll walk you through how I’ve wired it all together, why Ansible is a homelab must-have, and what I’ve learned along the way—tabs vs spaces debates included.


Why Ansible in a Homelab?

Ansible is like having a superpower. You write some YAML, press play, and your servers obediently reconfigure themselves. For homelabbers, that means:

  • No more SSHing into 12 boxes just to update Docker.
  • Consistent environments across VMs, bare metal, and containers.
  • The ability to break things gloriously—and recover just as easily.

It’s agentless, which is a big win in a homelab where resources are limited and you don’t want to bloat your nodes with background daemons. Plus, it’s easy to read (my future self appreciates this).


Enter AWX: The Missing UI for Ansible

Sure, I love the terminal as much as the next nerd, but AWX gives me the dashboard I didn’t know I needed. It’s like Ansible with a side of polish:

  • Job templates for all my playbooks: OS patching, reboot cycles, app installs.
  • Schedules for auto-running playbooks (because let’s face it, I’ll forget).
  • Logs and output in a clean UI instead of scrolling through my shell history.
  • Role-based access control for… well, just me. But hey, future-proofing.

How I Have It Set Up

Here’s how I stitched everything together in my homelab, without needing a fleet of enterprise-grade tools or a DevOps team on call:

🗂️ 1. GitLab as the Source of Truth

All my Ansible playbooks live in a private repo on my self-hosted GitLab instance. This gives me:

  • Version control (no more "final_v2_REALLYFINAL.yaml" nonsense)
  • Easy collaboration with… myself
  • A backup I actually trust

Any changes to configurations get committed, reviewed (mentally), and pushed. Git is the foundation of the whole workflow.

🔄 2. AWX Syncs It All In

AWX connects directly to my GitLab repo using a personal access token. Whenever I push to the repo, I can trigger a sync in AWX that pulls in the latest playbooks and roles. This keeps my automation brain in one place and my execution engine in another.

🛠️ 3. Job Templates for Every Use Case

Inside AWX, I’ve set up job templates for all the regular tasks I run:

  • Patch and reboot schedules for my Proxmox and Debian hosts
  • Playbooks to spin up new VMs or reconfigure existing ones
  • One-click deployment of self-hosted apps (hello, Home Assistant and Uptime Kuma)
  • Even a playbook that resets my lab DNS stack if something goes sideways

Each job template is parameterized with variables, so I can tweak behaviors without duplicating code.

⏰ 4. Automation on My Terms

Some playbooks I run on-demand, like when I’m testing a new setup or provisioning a new machine. Others are scheduled:

  • Weekly OS patching
  • Nightly Docker container restarts
  • Monthly “lab drift” checks to re-apply known-good configs

AWX handles execution and logs everything in a beautiful, readable UI. And yes—I get notifications via webhook so I know when things run (or break).


What I’ve Learned (Besides YAML Hates Tabs)

  • My homelab is now reproducible. If I nuke it all tomorrow, I could rebuild it with a few AWX jobs.
  • No more drift. I know exactly how each machine is configured, and it stays that way.
  • Debugging is easier. AWX logs everything. When something goes sideways, I can retrace my steps and fix it fast.
  • It’s fun again. Automation takes the grunt work out of homelabbing, so I can focus on new projects instead of constant maintenance.

Final Thoughts

Is using AWX and GitLab overkill for a homelab? Maybe. But that’s kind of the point. Homelabs aren’t about necessity—they’re about learning, experimenting, and sometimes pretending you're your own SRE t