---
title: Homelab in Ansible
showOnCv: false
type: Personal
abstract: A small fleet of personal servers running Dockerized services, all deployed and managed from a single Ansible repository with Traefik for routing and Gatus for monitoring.

content:
  - src: cover
    filetype: .webp
    subtitle: fzf shell script to quickly deploy services

pdfFiles: []

quickLinks: []

keywords: []
supervisors: []
keyFeatures: []
tags:
  - DevOps
  - Automation
  - Infrastructure
  - Docker
  - Ansible
  - Traefik
---

I first ran into Infrastructure as Code during the [Virtualization and Cloud Computing](/projects/vcc-exam) course at UniGe. We had to set up a full "cloud" using Vagrant and Ansible, and once I saw what that made possible I started doing the same for my own servers.

The setup now spans a few machines in different places (a local server at home, an Oracle Cloud VM and an Azure VM) that together host my websites, a handful of self-hosted apps, uptime monitoring and some smaller internal tools. The whole thing is described in one Ansible repo, with [Traefik](https://traefik.io) in front of every service as a reverse proxy and secrets kept in an Ansible Vault file. Moving a service from one machine to another is essentially a one-line change followed by a redeploy.

To make day-to-day use less painful I built a small zsh script around [fzf](https://github.com/junegunn/fzf) that lets me pick services or hosts and run the right playbook without having to remember any flags. On top of that, [Watchtower](https://github.com/containrrr/watchtower) (which is sadly no longer maintained) keeps [the images I build myself](/projects/workflow-templates) up to date automatically, and [Gatus](https://github.com/TwiN/gatus) acts as a central status page that probes everything and pings a self-hosted [ntfy](https://ntfy.sh) instance whenever something goes down, so an alert ends up on my phone within seconds.

The main reason I keep using this is how cheap changes have become. Spinning up a new server, replacing one or moving a service somewhere else is mostly an inventory tweak and another run of the script, and a few months later it is still easy to come back to since everything lives in one place rather than as quietly-different state on each machine.
