Shorted cleanup- to cln-

This commit is contained in:
Kevin Veen-Birkenbach 2025-07-09 03:45:02 +02:00
parent 9668e74139
commit f548faa80f
No known key found for this signature in database
GPG Key ID: 44D8F11FD62F878E
60 changed files with 88 additions and 88 deletions

View File

@ -17,6 +17,6 @@ Follow these guides to install and configure CyMaIS:
## Managing & Updating CyMaIS 🔄
- Regularly update services using `update-docker`, `update-pacman`, or `update-apt`.
- Monitor system health with `mon-bot-btrfs`, `mon-bot-webserver`, and `mon-bot-docker-container`.
- Automate system maintenance with `maint-lock`, `cleanup-backups-service`, and `maint-docker-restart`.
- Automate system maintenance with `maint-lock`, `cln-backups-service`, and `maint-docker-restart`.
For more details, refer to the specific guides above.

View File

@ -20,9 +20,9 @@ system_maintenance_backup_services:
### Defined Services for System Cleanup
system_maintenance_cleanup_services:
- "cleanup-backups"
- "cleanup-disc-space"
- "cleanup-failed-docker-backups"
- "cln-backups"
- "cln-disc-space"
- "cln-failed-docker-backups"
### Services that Manipulate the System
system_maintenance_manipulation_services:

View File

@ -78,7 +78,7 @@ For a complete list of role categories and detailed definitions, see:
- **maint-docker-***
Automated recovery and restarts for Docker Compose workloads.
- **cleanup-***
- **cln-***
Housekeeping tasks (old backups, certs, log rotation).
---
@ -112,7 +112,7 @@ For a complete list of role categories and detailed definitions, see:
> **Tip:** To find a role quickly, search for its prefix:
> `core-`, `generic-`, `desk-`, `webserver-`, `web-service-`, `web-app-`,
> `network-`, `service-`, `monitor-`, `alert-`, `maint-`, `cleanup-`,
> `network-`, `service-`, `monitor-`, `alert-`, `maint-`, `cln-`,
> `bkp-`, `update-`, `pkgmgr-`, `user-`.
---

View File

@ -23,5 +23,5 @@ galaxy_info:
issue_tracker_url: https://s.veen.world/cymaisissues
documentation: https://s.veen.world/cymais
dependencies:
- cleanup-backups-service
- cln-backups-service
- maint-lock

View File

@ -6,7 +6,7 @@ OnFailure=alert-compose.cymais@%n.service
[Service]
Type=oneshot
ExecStart=/bin/python {{ backup_to_usb_script_path }} {{backup_to_usb_source}} {{backup_to_usb_destination}}
ExecStartPost=/bin/systemctl start cleanup-backups.cymais.service
ExecStartPost=/bin/systemctl start cln-backups.cymais.service
[Install]
WantedBy=multi-user.target

View File

@ -2,7 +2,7 @@
## Description
This Ansible role installs the [directory-validator](https://github.com/kevinveenbirkenbach/directory-validator.git). It is used by the bkp-docker-to-local and cleanup-failed-docker-backups roles to verify whether backups have been successfully created.
This Ansible role installs the [directory-validator](https://github.com/kevinveenbirkenbach/directory-validator.git). It is used by the bkp-docker-to-local and cln-failed-docker-backups roles to verify whether backups have been successfully created.
## Overview

View File

@ -8,7 +8,7 @@ This Ansible role automates the process of backing up Docker volumes to a local
Optimized for Archlinux, this role ensures that Docker volume backups are performed reliably with minimal manual intervention. It integrates with several dependent roles to verify backup success and manage related tasks, including:
- [bkp-directory-validator](../bkp-directory-validator/) Validates backup directories.
- [cleanup-failed-docker-backups](../cleanup-failed-docker-backups/) Cleans up unsuccessful backup attempts.
- [cln-failed-docker-backups](../cln-failed-docker-backups/) Cleans up unsuccessful backup attempts.
- [generic-timer](../generic-timer/) Schedules recurring backup tasks.
- [bkp-provider](../bkp-provider/) Manages backup sources.
- [maint-lock](../maint-lock/) Ensures coordinated maintenance operations.

View File

@ -25,6 +25,6 @@ galaxy_info:
dependencies:
- bkp-provider
- alert-compose
- cleanup-failed-docker-backups
- cln-failed-docker-backups
- maint-lock
- bkp-directory-validator

View File

@ -1,6 +1,6 @@
[Unit]
Description=backup docker volumes to local folder
OnFailure=alert-compose.cymais@%n.service cleanup-failed-docker-backups.cymais.service
OnFailure=alert-compose.cymais@%n.service cln-failed-docker-backups.cymais.service
[Service]
Type=oneshot

View File

@ -1,6 +1,6 @@
[Unit]
Description=backup docker volumes to local folder
OnFailure=alert-compose.cymais@%n.service cleanup-failed-docker-backups.cymais.service
OnFailure=alert-compose.cymais@%n.service cln-failed-docker-backups.cymais.service
[Service]
Type=oneshot

View File

@ -8,7 +8,7 @@ This role sets up and manages the host as a backup provider. It establishes the
Optimized for automated backup processes, this role:
- Configures the host to provide backup services.
- Integrates seamlessly with the [bkp-provider-user](../bkp-provider-user/README.md) and [cleanup-backups-timer](../cleanup-backups-timer/README.md) roles.
- Integrates seamlessly with the [bkp-provider-user](../bkp-provider-user/README.md) and [cln-backups-timer](../cln-backups-timer/README.md) roles.
- Lays the foundation for secure and extensible backup operations.
## Purpose

View File

@ -24,4 +24,4 @@ galaxy_info:
documentation: "https://s.veen.world/cymais"
dependencies:
- bkp-provider-user
- cleanup-backups-timer
- cln-backups-timer

View File

@ -17,7 +17,7 @@ Backup Remote to Local is a robust solution for retrieving backup data from remo
- **Remote Backup Retrieval:** Pulls backups from a remote server using secure SSH connections.
- **Incremental Backup with rsync:** Uses rsync with options for archive, backup, and hard linking to efficiently manage changes.
- **Retry Logic:** Implements a retry mechanism to handle transient network issues or remote errors.
- **Integration with Other Roles:** Works alongside roles like bkp-directory-validator, cleanup-failed-docker-backups, generic-timer, bkp-provider, and maint-lock.
- **Integration with Other Roles:** Works alongside roles like bkp-directory-validator, cln-failed-docker-backups, generic-timer, bkp-provider, and maint-lock.
- **Administrative Debugging:** Detailed debug instructions and administrative tasks are provided in a separate file.
## Other Resources

View File

@ -27,7 +27,7 @@ galaxy_info:
dependencies:
- generic-git
- alert-compose
- cleanup-backups-timer
- cleanup-failed-docker-backups
- cln-backups-timer
- cln-failed-docker-backups
- maint-lock
- user-root

View File

@ -1,6 +1,6 @@
[Unit]
Description=pull remote backups
OnFailure=alert-compose.cymais@%n.service cleanup-failed-docker-backups.cymais.service
OnFailure=alert-compose.cymais@%n.service cln-failed-docker-backups.cymais.service
[Service]
Type=oneshot

View File

@ -1,5 +0,0 @@
- name: "reload cleanup-backups.cymais.service"
systemd:
name: cleanup-backups.cymais.service
enabled: yes
daemon_reload: yes

View File

@ -1 +0,0 @@
cleanup_backups_directory: "{{path_administrator_scripts}}cleanup-backups/"

View File

@ -1,6 +0,0 @@
- name: "Reload and restart cleanup-certs.cymais.service"
systemd:
name: cleanup-certs.cymais.service
enabled: yes
daemon_reload: yes
state: restarted

View File

@ -1,5 +0,0 @@
- name: "reload cleanup-disc-space.cymais.service"
systemd:
name: cleanup-disc-space.cymais.service
enabled: yes
daemon_reload: yes

View File

@ -1 +0,0 @@
cleanup_disc_space_folder: "{{path_administrator_scripts}}cleanup-disc-space/"

View File

@ -1,5 +0,0 @@
- name: "Reload cleanup-failed-docker-backups.cymais.service"
systemd:
name: cleanup-failed-docker-backups.cymais.service
enabled: yes
daemon_reload: yes

View File

@ -0,0 +1,5 @@
- name: "reload cln-backups.cymais.service"
systemd:
name: cln-backups.cymais.service
enabled: yes
daemon_reload: yes

View File

@ -13,17 +13,17 @@
mode: 0755
when: run_once_cleanup_backups_service is not defined
- name: create cleanup-backups.py
- name: create cln-backups.py
copy:
src: "cleanup-backups.py"
dest: "{{cleanup_backups_directory}}cleanup-backups.py"
src: "cln-backups.py"
dest: "{{cleanup_backups_directory}}cln-backups.py"
when: run_once_cleanup_backups_service is not defined
- name: create cleanup-backups.cymais.service
- name: create cln-backups.cymais.service
template:
src: "cleanup-backups.service.j2"
dest: "/etc/systemd/system/cleanup-backups.cymais.service"
notify: reload cleanup-backups.cymais.service
src: "cln-backups.service.j2"
dest: "/etc/systemd/system/cln-backups.cymais.service"
notify: reload cln-backups.cymais.service
when: run_once_cleanup_backups_service is not defined
- name: run the cleanup_backups_service tasks once

View File

@ -5,4 +5,4 @@ OnFailure=alert-compose.cymais@%n.service
[Service]
Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
ExecStart=/bin/sh -c '/usr/bin/python {{cleanup_backups_directory}}cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}}'
ExecStart=/bin/sh -c '/usr/bin/python {{cleanup_backups_directory}}cln-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}}'

View File

@ -0,0 +1 @@
cleanup_backups_directory: "{{path_administrator_scripts}}cln-backups/"

View File

@ -2,13 +2,13 @@
## Description
This role sets up a systemd timer to schedule the periodic cleanup of old backups. It leverages the cleanup-backups-service role to perform the actual cleanup operation.
This role sets up a systemd timer to schedule the periodic cleanup of old backups. It leverages the cln-backups-service role to perform the actual cleanup operation.
## Overview
Optimized for automated maintenance, this role:
- Sets a fact for the service name.
- Integrates with the [generic-timer](../generic-timer/README.md) role to schedule cleanup-backups tasks at defined intervals.
- Integrates with the [generic-timer](../generic-timer/README.md) role to schedule cln-backups tasks at defined intervals.
## Purpose
@ -17,5 +17,5 @@ The primary purpose of this role is to automate the scheduling of backup cleanup
## Features
- **Timer Scheduling:** Configures a systemd timer to trigger the backup cleanup service.
- **Role Integration:** Works in conjunction with the cleanup-backups-service role.
- **Role Integration:** Works in conjunction with the cln-backups-service role.
- **Idempotency:** Ensures the timer tasks execute only once per playbook run.

View File

@ -1,7 +1,7 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Schedules periodic cleanup of old backups by configuring a systemd timer to trigger the cleanup-backups-service role."
description: "Schedules periodic cleanup of old backups by configuring a systemd timer to trigger the cln-backups-service role."
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
company: |
@ -22,4 +22,4 @@ galaxy_info:
issue_tracker_url: "https://s.veen.world/cymaisissues"
documentation: "https://s.veen.world/cymais"
dependencies:
- cleanup-backups-service
- cln-backups-service

View File

@ -1,6 +1,6 @@
- name: set service_name to cleanup-backups
- name: set service_name to cln-backups
set_fact:
service_name: "cleanup-backups"
service_name: "cln-backups"
when: run_once_cleanup_backups_timer is not defined
- name: "include role for generic-timer for {{service_name}}"

View File

@ -7,7 +7,7 @@ This Ansible role automates the detection, revocation and deletion of unused Let
## Overview
- Installs the `certreap` cleanup tool using the `pkgmgr-install` role
- Deploys and configures a `cleanup-certs.cymais.service` systemd unit
- Deploys and configures a `cln-certs.cymais.service` systemd unit
- (Optionally) Sets up a recurring cleanup via a systemd timer using the `generic-timer` role
- Integrates with `alert-compose` to send failure notifications
- Ensures idempotent execution with a `run_once_cleanup_certs` flag
@ -18,7 +18,7 @@ This Ansible role automates the detection, revocation and deletion of unused Let
Uses `pkgmgr-install` to install the `certreap` binary.
- **Systemd Service Configuration**
Deploys `cleanup-certs.cymais.service` and reloads/restarts it on changes.
Deploys `cln-certs.cymais.service` and reloads/restarts it on changes.
- **Systemd Timer Scheduling**
Optionally wires in a timer via the `generic-timer` role, controlled by the `on_calendar_cleanup_certs` variable.
@ -27,7 +27,7 @@ This Ansible role automates the detection, revocation and deletion of unused Let
Prevents multiple runs in one play by setting a `run_once_cleanup_certs` fact.
- **Failure Notification**
Triggers `alert-compose.cymais@cleanup-certs.cymais.service` on failure.
Triggers `alert-compose.cymais@cln-certs.cymais.service` on failure.
## Further Resources

View File

@ -0,0 +1,6 @@
- name: "Reload and restart cln-certs.cymais.service"
systemd:
name: cln-certs.cymais.service
enabled: yes
daemon_reload: yes
state: restarted

View File

@ -5,11 +5,11 @@
package_name: certreap
when: run_once_cleanup_certs is not defined
- name: configure cleanup-certs.cymais.service
- name: configure cln-certs.cymais.service
template:
src: cleanup-certs.service.j2
dest: /etc/systemd/system/cleanup-certs.cymais.service
notify: Reload and restart cleanup-certs.cymais.service
src: cln-certs.service.j2
dest: /etc/systemd/system/cln-certs.cymais.service
notify: Reload and restart cln-certs.cymais.service
when: run_once_cleanup_certs is not defined
- name: set service_name to the name of the current role

View File

@ -0,0 +1,5 @@
- name: "reload cln-disc-space.cymais.service"
systemd:
name: cln-disc-space.cymais.service
enabled: yes
daemon_reload: yes

View File

@ -4,16 +4,16 @@
state: directory
mode: 0755
- name: create cleanup-disc-space.sh
- name: create cln-disc-space.sh
template:
src: cleanup-disc-space.sh.j2
dest: "{{cleanup_disc_space_folder}}cleanup-disc-space.sh"
src: cln-disc-space.sh.j2
dest: "{{cleanup_disc_space_folder}}cln-disc-space.sh"
- name: create cleanup-disc-space.cymais.service
- name: create cln-disc-space.cymais.service
template:
src: cleanup-disc-space.service.j2
dest: /etc/systemd/system/cleanup-disc-space.cymais.service
notify: reload cleanup-disc-space.cymais.service
src: cln-disc-space.service.j2
dest: /etc/systemd/system/cln-disc-space.cymais.service
notify: reload cln-disc-space.cymais.service
- name: set service_name to the name of the current role
set_fact:

View File

@ -5,4 +5,4 @@ OnFailure=alert-compose.cymais@%n.service
[Service]
Type=oneshot
ExecStartPre=/bin/sh -c '/usr/bin/python {{ path_system_lock_script }} {{ system_maintenance_services | join(' ') }} --ignore {{system_maintenance_cleanup_services| join(' ') }} --timeout "{{system_maintenance_lock_timeout_backup_services}}"'
ExecStart=/bin/sh -c '/bin/bash {{cleanup_disc_space_folder}}cleanup-disc-space.sh {{size_percent_cleanup_disc_space}}'
ExecStart=/bin/sh -c '/bin/bash {{cleanup_disc_space_folder}}cln-disc-space.sh {{size_percent_cleanup_disc_space}}'

View File

@ -24,7 +24,7 @@ if [ "$force_freeing" = true ]; then
{% if backups_folder_path is defined and size_percent_maximum_backup is defined %}
echo "cleaning up backups" &&
python {{path_administrator_scripts}}cleanup-backups/cleanup-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} || exit 2
python {{path_administrator_scripts}}cln-backups/cln-backups.py --backups-folder-path {{backups_folder_path}} --maximum-backup-size-percent {{size_percent_maximum_backup}} || exit 2
{% endif %}
if pacman -Qs $package > /dev/null ; then

View File

@ -0,0 +1 @@
cleanup_disc_space_folder: "{{path_administrator_scripts}}cln-disc-space/"

View File

@ -1,4 +1,4 @@
# cleanup-domains
# cln-domains
## Description

View File

@ -2,12 +2,12 @@
## Description
This role cleans up failed Docker backups by pulling a [Git repository](https://github.com/kevinveenbirkenbach/cleanup-failed-docker-backups) that contains cleanup scripts and configuring a systemd service to execute them. It ensures that failed or incomplete backups are removed to free up disk space and maintain a healthy backup environment.
This role cleans up failed Docker backups by pulling a [Git repository](https://github.com/kevinveenbirkenbach/cln-failed-docker-backups) that contains cleanup scripts and configuring a systemd service to execute them. It ensures that failed or incomplete backups are removed to free up disk space and maintain a healthy backup environment.
## Overview
Optimized for backup maintenance, this role:
- Clones the cleanup-failed-docker-backups repository.
- Clones the cln-failed-docker-backups repository.
- Configures a systemd service to run the cleanup script.
- Integrates with the [generic-timer](../generic-timer/README.md) role to schedule periodic cleanup.
- Works in conjunction with the bkp-directory-validator role for additional verification.

View File

@ -0,0 +1,5 @@
- name: "Reload cln-failed-docker-backups.cymais.service"
systemd:
name: cln-failed-docker-backups.cymais.service
enabled: yes
daemon_reload: yes

View File

@ -2,26 +2,26 @@
include_role:
name: pkgmgr-install
vars:
package_name: cleanup-failed-docker-backups
package_name: cln-failed-docker-backups
when: run_once_cleanup_failed_docker_backups is not defined
- name: Retrieve bkp-docker-to-local path from pkgmgr
command: pkgmgr path cleanup-failed-docker-backups
command: pkgmgr path cln-failed-docker-backups
register: pkgmgr_output
changed_when: false
when: run_once_cleanup_failed_docker_backups is not defined
- name: Set fact for backup_docker_to_local_cleanup_script
set_fact:
backup_docker_to_local_cleanup_script: "{{ pkgmgr_output.stdout.rstrip('/') ~ '/cleanup-all.sh' }}"
backup_docker_to_local_cleanup_script: "{{ pkgmgr_output.stdout.rstrip('/') ~ '/cln-all.sh' }}"
changed_when: false
when: run_once_cleanup_failed_docker_backups is not defined
- name: configure cleanup-failed-docker-backups.cymais.service
- name: configure cln-failed-docker-backups.cymais.service
template:
src: cleanup-failed-docker-backups.service.j2
dest: /etc/systemd/system/cleanup-failed-docker-backups.cymais.service
notify: Reload cleanup-failed-docker-backups.cymais.service
src: cln-failed-docker-backups.service.j2
dest: /etc/systemd/system/cln-failed-docker-backups.cymais.service
notify: Reload cln-failed-docker-backups.cymais.service
when: run_once_cleanup_failed_docker_backups is not defined
- name: set service_name to the name of the current role

View File

@ -16,7 +16,7 @@ This role is built on top of your existing `webserver-core` role, and it automat
When you apply **webserver-https**, it will:
1. **Include** the `webserver-core` role to install and configure Nginx.
2. **Clean up** any stale vHost files under `cleanup-domains`.
2. **Clean up** any stale vHost files under `cln-domains`.
3. **Deploy** the Lets Encrypt challenge-and-redirect snippet from `network-letsencrypt`.
4. **Reload** Nginx automatically when any template changes.

View File

@ -25,5 +25,5 @@ galaxy_info:
dependencies:
- webserver-core
- cleanup-domains
- cln-domains
- network-letsencrypt

View File

@ -30,4 +30,4 @@ dependencies:
- generic-certbot
- webserver-core
- alert-compose
- cleanup-certs
- cln-certs

View File

@ -7,7 +7,7 @@
- core-security
- core-journalctl
- mon-bot-disc-space
- cleanup-disc-space
- cln-disc-space
- mon-bot-btrfs
- maint-btrfs-auto-balancer

View File

@ -5,7 +5,7 @@
- name: Cleanup Docker Anonymous Volumes
import_role:
name: cleanup-docker-anonymous-volumes
name: cln-docker-anonymous-volumes
when: mode_cleanup | bool
- name: Show all facts