/homelab-ansible

Collection of Ansible roles and playbooks that I use to develop, deploy, and test my Homelab systems and services.

Homelab Ansible Scripts

This repo contains a collection of Ansible roles and playbooks that I use to develop and maintain my homelab environment. Not everything has made it's way into an Ansible role or playbook, but we're getting there.

To-Do

  • Re-write Jellyfin/XMLTV deployment
    • Should be combined into one Docker compose
    • Volumes don't really need to mount to the host
    • Might re-write XMLTV in Rust
  • Create Kubernetes role
  • Create OpenVPN or WireGuard role

Playbooks

  • main.yml - (eventually) target state single playbook for provisioning entire lab
  • kube.yml - quick any dirty playbook to get Kubernetes running
  • docker_install.yml - one off role apply for hosts
  • monthly_patch.yml - run every month on patch Tuesday to update and restart the hosts

Roles

  • Docker
  • Jellyfin
    • Runs in Docker with mounts for recordings, guide input
  • zap2xml (XMLTV OTA Guide Feed)
    • Runs in Docker with mount for guide output
  • Minecraft Servers
    • Vanilla (PaperMC)
    • Modded (ATM8, SkyFactory4)

The Minecraft Details

For simplicity sake, we'll discuss the vanilla/PaperMC implementation. The modded servers work on the same principle, but there slight changes to get the modified JARs and installers to work accordingly. For more information on the configuration logic, take a look at the comments in the playbook.

Files

  • server directory - contains minimum file set required to bootstrap the server with specified configuration
    • Eventually this will get parameterized via script, but for now you must configure the server settings before running the role
  • minecraft.service - systemd service file that controls start, stop, restart, IO behavior of the MC server
  • minecraft.socket - systemd socket file that defined the STDIN socket used to pass commands to the server
  • minecraft.sudoers - members of the 'minecraft' group may control the service
  • minecraft.xml - (unused) firewalld service definition file
  • sdchown_local.te - SELinux module to allow the FIFO file to be owned by minecraft (I think... not an SELinux expert; this was generated by SELinux)
  • sh_socket_local.te - SELinux module to allow IO to FIFO file from non-root users
  • systemd_socket_local.te - SELinux module to allow systemd to manage the FIFO/socket

Vars

  • minecraft_version - specifies the Mojang/Microsoft SemVer Minecraft: Java Edition release
  • papermc_version - specifies the release of PaperMC (relative to MC version)
  • papermc_server_url - FQ address of download link