Files
esh-pfi-infrastructure/playbooks/remove-autorestic.yaml
T
vh ac282c5526 playbooks/remove-autorestic + STATUS: decommission autorestic, mark docker-ce migration done
Migration complete:
* ana-docker on docker-ce 29.4.1, all 29 containers back up. Traefik
  routing live (verified 200s on matrix.phasefinal.com presence +
  seafile.phasefinal.com syncs).
* traefik-postboot.service installed + enabled on both traefik hosts
  (esh-docker-vm, ana-docker) — one-shot systemd unit that restarts
  traefik 60s after every boot, fixing the long-standing routing-races-
  after-reboot symptom.

New playbook: remove-autorestic. Triggered by a typo (`D:escription`
in autorestic-backup.timer line 2) flagged by systemd-analyze during
the traefik-postboot install on esh-docker-vm. Rather than fix it,
remove autorestic — it's redundant with the PBS + structured-restic
two-layer pipeline that's been operational since 2026-04-22. Detected
on two ESH-side hosts: esh-docker-vm and esh-vm-db. Playbook removes
the four unit files + the /usr/local/bin/autorestic binary; leaves
/srv/backups/autorestic/.autorestic.yml (archival) and
/mnt/backup/restic/repo/esh (historical snapshots) for separate
disposition.

Sub-finding from ana-docker upgrade: seafile's seahub (the Python
frontend at port 8000 inside the container) failed to start because
mysql wasn't ready when seafile booted, and a single restart didn't
recover it. Traefik routes return 502 on seafile dynamic endpoints
until seahub is up. Needs separate triage of seafile's depends_on
wiring or seahub's retry behavior — not a docker-ce regression.
2026-04-26 14:36:56 -07:00

90 lines
3.5 KiB
YAML

# remove-autorestic — fully decommission autorestic on a host.
#
# Why: autorestic was the original ESH home-lab backup tool (manual install
# at /usr/local/bin/autorestic, daily + monthly systemd timers). The new
# two-layer pipeline (PBS for VM images via the hypervisor, structured
# restic profiles via configs/restic/<host>/profiles.yaml) covers
# everything autorestic was doing, so it's redundant — and the typo
# `D:escription` in autorestic-backup.timer caught during the
# traefik-postboot install on esh-docker-vm prompted ripping it out
# rather than fixing it.
#
# Hosts in scope (autorestic detected 2026-04-26):
# esh-docker-vm, esh-vm-db
# Skips on hosts without it (every step is `creates:`-/`when:`-gated).
#
# What this DOES remove:
# - /etc/systemd/system/autorestic-{backup,prune}.{service,timer}
# - /usr/local/bin/autorestic
#
# What this DOES NOT touch (decide separately):
# - /srv/backups/autorestic/.autorestic.yml — the config; archival
# value (records what was being backed up + the restic key)
# - /mnt/backup/restic/repo/esh — historical autorestic snapshots
# (real backup data; user can prune with `restic forget` once they're
# comfortable the new pipeline has equivalent coverage)
#
# Usage:
# scripts/elway esh-docker-vm --playbook playbooks/remove-autorestic.yaml
# scripts/elway esh-vm-db --playbook playbooks/remove-autorestic.yaml
steps:
- name: Stop + disable autorestic-backup.timer
shell: systemctl disable --now autorestic-backup.timer
sudo: true
when: "systemctl list-unit-files autorestic-backup.timer --no-legend 2>/dev/null | grep -q ."
- name: Stop + disable autorestic-prune.timer
shell: systemctl disable --now autorestic-prune.timer
sudo: true
when: "systemctl list-unit-files autorestic-prune.timer --no-legend 2>/dev/null | grep -q ."
- name: Stop autorestic-backup.service (if running)
# Should be a no-op after disable --now above, but a long-running
# backup invocation triggered manually could still be live. Safe
# to call on a stopped unit.
shell: systemctl stop autorestic-backup.service 2>/dev/null || true
sudo: true
- name: Stop autorestic-prune.service (if running)
shell: systemctl stop autorestic-prune.service 2>/dev/null || true
sudo: true
- name: Remove autorestic systemd unit files
shell: rm -f /etc/systemd/system/autorestic-backup.service \
/etc/systemd/system/autorestic-backup.timer \
/etc/systemd/system/autorestic-prune.service \
/etc/systemd/system/autorestic-prune.timer
sudo: true
removes: /etc/systemd/system/autorestic-backup.timer
- name: systemctl daemon-reload (drop the removed units from systemd's view)
shell: systemctl daemon-reload
sudo: true
- name: systemctl reset-failed (clear any leftover failed-state for autorestic-*)
shell: systemctl reset-failed 'autorestic-*' 2>/dev/null || true
sudo: true
- name: Remove the autorestic binary
shell: rm -f /usr/local/bin/autorestic
sudo: true
removes: /usr/local/bin/autorestic
verify:
- name: No autorestic systemd units remain
shell: |
n=$(ls /etc/systemd/system/autorestic-* 2>/dev/null | wc -l)
[ "$n" = "0" ]
changed_when: "false"
- name: No autorestic binary on PATH
shell: ! command -v autorestic >/dev/null
changed_when: "false"
- name: systemd no longer knows about autorestic units
shell: |
n=$(systemctl list-unit-files 'autorestic-*' --no-legend 2>/dev/null | wc -l)
[ "$n" = "0" ]
changed_when: "false"