From the very beginning, I used an Infrastructure as Code (IaaC) approach in my homelab. However, due to privacy concerns, I couldn’t publish it as open source. Recently, I spent a lot of time separating sensitive information so that I could publish the rest as open source 😊

Check it out here: https://github.com/mkuthan/homelab-public

Why IaaC?

What is a main challenge in a homelab? For me it’s the same as in a production environment - keeping everything up to date, secure, and reliable while minimizing manual work.

I’m a software engineer, so I’m used to writing beatiful, testable code. In the infrastructure world, it’s not that easy. Fortunately, IaaC tools like Terraform and Ansible help me to write infrastructure code in a way I’m used to.

Terraform

Terraform defines the following resources in my homelab:

πŸ–₯️ Linux containers (LXC) using the Telmate Proxmox provider. It covers most of the container resource definitions: CPU, memory, root disk, mount points, networking, SSH keys, and nested virtualization. In the Proxmox UI, I only define replication and high availability settings.

☁️ Virtual Private Server (VPS) with required networking resources in Google Cloud Platform (GCP). I use this VPS for hosting Uptime Kuma to monitor my homelab services.

πŸ“¦ Bucket on Google Cloud Storage (GCS) for storing offsite backups.

πŸ”’ Tailscale access control lists (ACLs). Thanks to data providers like tailscale_devices or tailscale_users I’m able to generate ACLs on the fly.

Ansible

Ansible roles define almost all the software I use in my homelab. I couldn’t imagine to maintain all that stuff manually. Here are some examples:

πŸ›‘οΈ Adguard DNS

πŸ“¦ Apt Cacher NG

πŸ› οΈ Backup Ninja

🐳 Docker

πŸ“Ή Frigate

πŸ“Š Grafana

πŸ“ˆ Grafana Agent

πŸ‘΄ Gramps

🌈 Hyperion NG

πŸ“Έ Immich

πŸŽ₯ Kodi

πŸ“‚ Loki

πŸ“§ Mailrise

🐝 Mosqquitto

πŸ”‹ NUT

🌐 Omada Software Controller

πŸ“„ Paperless NGX

πŸ’Ύ Proxmox Backup Server

πŸ“ˆ Prometheus

🎡 Raspotify

πŸ”„ RClone

πŸ–₯️ Samba

πŸ” SearXNG

🎢 Shairport

πŸ“„ Stirling PDF

πŸ”’ Tailscale

πŸš€ Traefik

πŸ“‘ Transmission

πŸ“Š Uptime Kuma

πŸ” Vaultwarden

πŸ” Whoogle

πŸ“‘ Zigbee2MQT

If you’re interested in how these services are set up in my homelab, you can explore the playbooks. Here are some examples: Proxmox hosts, Raspberry Pi, VPS.

Please note that I use a dynamic Ansible inventory for all my Linux containers. You can find more details in the inventory.proxmox.yml file. The static inventory includes only non-virtualized hosts such as Proxmox VE, Raspberry Pi, and VPS.

Conclusion

I hope you find my homelab setup useful and inspiring. If you have any questions, feel free to ask me on GitHub Discussions.

Updated:

Comments