Add service registry, shared roles and unified reverse proxy

Collect the facts about all 14 services -- VMID, node, address, ports,
domain, pinned images, resources, backup and monitoring participation --
into group_vars/all/services.yml. Values are taken from the existing
playbooks; gaps are marked null rather than invented.

Replace reverse-proxy-{gitea,vaultwarden,grimmory}.yml with a single
playbook iterating over registry entries that declare a domain. It keeps
every check the three had, preserves grimmory's richer Caddy block
byte-for-byte, and restarts Caddy once when any site changed instead of
up to three times. Verified with --check --diff against ru-vps: ok=6
changed=0, so it reproduces the current Caddyfile exactly.

Add two roles factoring out the skeleton duplicated across the pve-*
playbooks: lxc_docker_host (packages, /dev/fuse assertion, fuse-overlayfs
storage driver, UFW baseline) and compose_service (compose file, systemd
unit, config validation, health check). They are not wired into any
playbook yet -- migrating a live service is a separate, per-service step;
compose_service/README.md shows the Gitea example and spells out what
actually changes on the host.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTocXkGUUazHdKKd3r9k71
This commit is contained in:
Dmitry
2026-08-26 22:10:16 +03:00
co-authored by Claude Opus 5
parent ec3b736250
commit 9725d3ea7c
15 changed files with 1503 additions and 218 deletions
+47
View File
@@ -0,0 +1,47 @@
# Роли Ansible
| Роль | Назначение |
|---|---|
| `backup_audit` | Аудит бэкапов PBS и restic, метрики в node-exporter |
| `bash_config` | Единый bash-конфиг для shell-хостов |
| `compose_service` | **(новая)** Docker Compose стек под systemd oneshot-юнитом |
| `emergency_access` | Аварийный доступ |
| `emergency_bot` | Telegram-бот аварийного доступа |
| `gyro` | Сервис gyro в изолированном LXC |
| `lxc_docker_host` | **(новая)** Подготовка непривилегированного LXC под Docker |
| `monitoring_blackbox` | Внешние HTTP-пробы с ru-vps |
| `monitoring_exporter` | node-exporter / smartctl-exporter |
| `monitoring_server` | Prometheus + Alertmanager + Grafana |
| `openvpn_gateway` | OpenVPN сервер/клиент |
| `pve_lxc` | Создание LXC через Proxmox API |
| `uptime_kuma` | Uptime Kuma |
| `base`, `docker`, `ufw` | Пустые каталоги, оставшиеся от ранней структуры |
## Новые роли
### `lxc_docker_host`
Пакеты, проверка `/dev/fuse`, `daemon.json` со `storage-driver:
fuse-overlayfs`, запуск docker, базовые правила UFW (SSH из LAN и OpenVPN,
node-exporter 9100 с 192.168.1.30, `deny incoming`), проверка эффективного
драйвера хранилища. Вынесено из восьми `pve-*.yml` — около 350 строк
копипасты. Подробности и пример: [`lxc_docker_host/README.md`](lxc_docker_host/README.md).
### `compose_service`
`compose.yml` + `.env` (генерация секретов один раз, `no_log`, `0600`) +
systemd-юнит `Type=oneshot` с `docker compose up -d --remove-orphans`,
`daemon-reload` через handler, валидация `docker compose config --quiet`,
рестарт только при изменениях, health-check по URL с `retries`/`until`.
Подробности и пример плейбука Gitea на новых ролях:
[`compose_service/README.md`](compose_service/README.md).
**Статус:** роли созданы и проверены синтаксически, но пока не подключены ни
к одному живому сервису. Перевод `pve-*.yml` на них — отдельный этап.
## Источник данных
Факты о сервисах (vmid, узел, адрес, порты, домен, образы с digest, ресурсы,
бэкап, мониторинг, порядок автозапуска) собраны в реестре
`ansible/inventory/group_vars/all/services.yml` (`homelab_services`).
Его уже потребляет `playbooks/reverse-proxy.yml`.