Watch
1
0
Fork
You've already forked home-ansible
0
No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Andrew Tomaka 046d76328a
npm: stop shadowing NPM templates, pin the image
The role bind-mounted an empty _hsts_map.conf over
/app/templates/_hsts_map.conf since 2024-06-13 (57ab4e4). That was a failed
workaround for NPM 2.11's "unknown hsts_header variable" bug: it removed the map
the HSTS template needs instead of fixing anything, and it only stayed harmless
because several old host configs still happened to define $hsts_header somewhere
in the http block.

NPM 2.17.0 split that variable into $hsts_header_plain / $hsts_header_subdomains,
so every HSTS proxy host re-rendered after the upgrade failed the config test:

  nginx: [emerg] unknown "hsts_header_plain" variable
  nginx: configuration file /etc/nginx/nginx.conf test failed

and was evicted from the running edge. work.atomaka.com disappeared this way on
2026-11-25; 11 other HSTS hosts were one save away from the same fate.

Changes:
- Drop the _hsts_map.conf bind mount and the empty file. The image's template is
  version-matched to the backend and must not be shadowed.
- Delete the dead default.conf and production.conf overrides. default.conf was
  mounted 2022-12..2023-10 and superseded by NPM's "default-site" setting (this
  box uses 444); production.conf was never mounted at all.
- Pin the image to 2.17.1 so template/variable changes are deliberate, and retry
  the nginx reload handler briefly because `docker compose up -d` may have just
  recreated the container.
- Treat `compose up -d` as idempotent so the play reports no change.

Verified: all 2.17-era and legacy host configs re-rendered (no $hsts_header
references remain), `nginx -t` clean with zero warnings, container running with
only /data and /etc/letsencrypt mounted, idempotent play (changed=0).
2026-11-25 22:01:36 -05:00
config Initial commit 2022-12-21 22:56:39 -05:00
roles npm: stop shadowing NPM templates, pin the image 2026-11-25 22:01:36 -05:00
.gitignore Ignore backup during temp solution 2023-05-16 22:11:15 -04:00
hosts Add cron to update pihole 2023-02-23 20:57:46 -05:00
README.md Updates after lost password 2026-11-25 18:37:19 -05:00
requirements.yml Include other stuff 2026-07-29 21:26:01 -04:00
site.yml Switch Pihole syncing 2025-10-12 10:00:26 -04:00

home-ansible

Setup random servers at home. It might work sometimes.

Getting started

  • ansible-galaxy install -r requirements.yml

other readme

Overview

This is a home Ansible repository for managing personal servers running Raspberry Pi OS (raspbian). It configures DNS servers (Pihole), proxy servers (nginx-proxy-manager with crowdsec), and common instance setup.

Setup

ansible-galaxy install -r requirements.yml

Environment variables are configured in .mise.toml and include:

  • ANSIBLE_PRIVATE_KEY_FILE: Path to the SSH private key used to connect to hosts
  • ANSIBLE_VAULT_PASSWORD_FILE: Path to the Ansible Vault password file (.vault-pass in the git bare root, outside this worktree)

Running Playbooks

Run the main playbook against all hosts:

ansible-playbook -i hosts site.yml

Run with specific tags:

ansible-playbook -i hosts site.yml --tags instance
ansible-playbook -i hosts site.yml --tags administrators
ansible-playbook -i hosts site.yml --tags pihole
ansible-playbook -i hosts site.yml --tags cs  # crowdsec
ansible-playbook -i hosts site.yml --tags npm  # nginx-proxy-manager

Run against specific hosts or groups:

ansible-playbook -i hosts site.yml --limit dns
ansible-playbook -i hosts site.yml --limit dns_1
ansible-playbook -i hosts site.yml --limit proxy

Architecture

Inventory Structure

The inventory is defined in the hosts file with three main groups:

  • dns: DNS servers running Pihole in Docker (dns_1, dns_2)
  • dns_1: Subset for the primary DNS server with nebula-sync for Pihole gravity syncing
  • proxy: Proxy servers running nginx-proxy-manager and crowdsec (proxy_1)

Playbook Structure

site.yml is the main playbook with three plays:

  1. All hosts: Runs common roles (instance, apt, administrators, ssh)
  2. DNS hosts: Installs Docker and Pihole
  3. DNS_1 host: Adds nebula-sync for syncing Pihole gravity database
  4. Proxy hosts: Installs Docker, crowdsec, and nginx-proxy-manager

Roles

  • instance: Base instance configuration
  • apt: APT package management
  • administrators: User and admin account setup
  • ssh: SSH server configuration
  • docker: Docker installation and setup
  • pihole: Pihole DNS server deployment (Docker-based)
  • nebula-sync: Syncs Pihole gravity database between dns_1 and dns_2
  • crowdsec: Crowdsec security engine
  • nginx-proxy-manager: Reverse proxy with web UI

Docker Compose Services

Some roles deploy services using Docker Compose:

  • nginx-proxy-manager: roles/nginx-proxy-manager/files/docker-compose.yml
  • nebula-sync: roles/nebula-sync/files/docker-compose.yml