Refactor systemctl services and timers

- Unified service templates into generic systemctl templates
- Introduced reusable filter plugins for script path handling
- Updated path variables and service/timer definitions
- Migrated roles (backup, cleanup, repair, etc.) to use systemctl role
- Added sys-daemon role for core systemd cleanup
- Simplified timer handling via sys-timer role

Note: This is a large refactor and some errors may still exist. Further testing and adjustments will be needed.
This commit is contained in:
2025-08-18 21:22:16 +02:00
parent 3a839cfe37
commit 2569abc0be
219 changed files with 618 additions and 1104 deletions

View File

@@ -1,11 +1,3 @@
- name: "reload sys-ctl-hlth-csp service"
systemd:
name: sys-ctl-hlth-csp{{ SYS_SERVICE_SUFFIX }}
enabled: yes
daemon_reload: yes
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
- name: rebuild checkcsp docker image
shell: checkcsp build
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"

View File

@@ -10,30 +10,8 @@
package_name: checkcsp
package_notify: rebuild checkcsp docker image
- name: "create {{ health_csp_crawler_folder }}"
file:
path: "{{ health_csp_crawler_folder }}"
state: directory
mode: "0755"
- name: copy sys-ctl-hlth-csp.py
copy:
src: sys-ctl-hlth-csp.py
dest: "{{ health_csp_crawler_script }}"
mode: "0755"
- name: create sys-ctl-hlth-csp{{ SYS_SERVICE_SUFFIX }}
template:
src: sys-ctl-hlth-csp.service.j2
dest: /etc/systemd/system/sys-ctl-hlth-csp{{ SYS_SERVICE_SUFFIX }}
notify: reload sys-ctl-hlth-csp service
- name: set service_name to role_name
set_fact:
service_name: "{{ role_name }}"
- name: include systemd timer role
include_role:
name: sys-timer
- include_role:
name: sys-systemctl
vars:
on_calendar: "{{ SYS_SCHEDULE_HEALTH_CSP_CRAWLER }}"
systemctl_on_calendar: "{{ SYS_SCHEDULE_HEALTH_CSP_CRAWLER }}"
systemctl_timer_enabled: true

View File

@@ -1,8 +0,0 @@
[Unit]
Description=Check for CSP-blocked resources via Puppeteer
OnFailure=sys-ctl-alm-compose.{{ SOFTWARE_NAME }}@%n.service
[Service]
Type=oneshot
ExecStart=/usr/bin/python3 {{ health_csp_crawler_script }} \
--nginx-config-dir={{ NGINX.DIRECTORIES.HTTP.SERVERS }}

View File

@@ -0,0 +1,7 @@
[Unit]
Description=Check for CSP-blocked resources via Puppeteer
OnFailure={{ SYS_SERVICE_ON_FAILURE_COMPOSE }}
[Service]
Type=oneshot
ExecStart=/usr/bin/python3 {{ systemctl_id | get_service_script_path('py') }} --nginx-config-dir={{ NGINX.DIRECTORIES.HTTP.SERVERS }}

View File

@@ -1,3 +1 @@
health_csp_crawler_folder: '{{ PATH_ADMINISTRATOR_SCRIPTS }}sys-ctl-hlth-csp/'
health_csp_crawler_script: '{{ health_csp_crawler_folder }}sys-ctl-hlth-csp.py'
systemctl_id: sys-ctl-hlth-csp