Reliability: - Add swap role (2GB, swappiness=10, idempotent via /etc/fstab) - Add mem_limit to plane-worker (512m) and plane-beat (256m) - Add health checks to all services (traefik, vaultwarden, forgejo, plane-*, syncthing, prometheus, grafana, loki) Code quality: - Remove Traefik Docker labels (file provider used, labels were dead code) - Add comment explaining file provider architecture Observability: - Add AlertManager with Telegram notifications - Add Prometheus alert rules: CPU, RAM, disk, swap, container health - Add Loki + Promtail for centralized log aggregation - Add Loki datasource to Grafana - Enable Traefik /ping endpoint for health checks Backups: - Add backup role: pg_dump for forgejo + plane DBs, tar for vaultwarden and forgejo data - 7-day retention, daily cron at 03:00 - Backup script at /usr/local/bin/backup-services Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
42 lines
992 B
YAML
42 lines
992 B
YAML
---
|
|
- name: Check if swap file exists
|
|
ansible.builtin.stat:
|
|
path: /swapfile
|
|
register: swapfile_stat
|
|
|
|
- name: Create swap file (2 GiB)
|
|
ansible.builtin.command: fallocate -l 2G /swapfile
|
|
when: not swapfile_stat.stat.exists
|
|
changed_when: true
|
|
|
|
- name: Set swap file permissions
|
|
ansible.builtin.file:
|
|
path: /swapfile
|
|
mode: "0600"
|
|
owner: root
|
|
group: root
|
|
when: not swapfile_stat.stat.exists
|
|
|
|
- name: Format swap file
|
|
ansible.builtin.command: mkswap /swapfile
|
|
when: not swapfile_stat.stat.exists
|
|
changed_when: true
|
|
|
|
- name: Enable swap
|
|
ansible.builtin.command: swapon /swapfile
|
|
when: not swapfile_stat.stat.exists
|
|
changed_when: true
|
|
|
|
- name: Persist swap in /etc/fstab
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/fstab
|
|
line: "/swapfile none swap sw 0 0"
|
|
state: present
|
|
|
|
- name: Set swappiness to 10 (prefer RAM over swap)
|
|
ansible.posix.sysctl:
|
|
name: vm.swappiness
|
|
value: "10"
|
|
state: present
|
|
sysctl_set: true
|
|
reload: true
|