Homelab Remove¶
Destroys a Homelab deployment safely and idempotently. The role enforces explicit confirmation and exposes granular flags to preserve selected data when needed.
Highlights¶
Requires
homelab_remove_confirm: truebefore any destructive action.Stops/disables the systemd service, deletes the unit file, and removes the Traefik dynamic config (toggle via
homelab_remove_traefik_config).Removes the
homelabuser, home directory, SQLite DB, and media tree when the correspondinghomelab_remove_*flags remaintrue.Prints a removal plan and pauses when database/media deletion is requested, giving operators a chance to bail out and run a backup first.
Idempotent: skips steps automatically if files/users already disappeared.
Key Variables¶
homelab_remove_confirm(required) – set totrueto proceed.homelab_remove_user/homelab_remove_home– remove system account/home directory (defaulttrue).homelab_remove_database,homelab_remove_media– delete SQLite DB and media tree (defaulttrue).homelab_remove_traefik_config– remove/etc/traefik/dynamic/homelab.yml.homelab_remove_auto_confirm– settrueto skip the interactive pause (useful for automation).
Usage example:
- hosts: macmini
become: true
roles:
- role: local.ops_library.homelab_remove
vars:
homelab_remove_confirm: true
homelab_remove_database: false # keep sqlite db
homelab_remove_media: false # keep uploaded files