mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 15:28:12 +02:00
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:
44
roles/sys-daemon/README.md
Normal file
44
roles/sys-daemon/README.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# Core Daemon Reset
|
||||
|
||||
## Description
|
||||
|
||||
This role resets and cleans up all **Infinito.Nexus** core daemon `systemd` service units that match the configured suffix (`SYS_SERVICE_SUFFIX`).
|
||||
It is primarily used in maintenance or reset scenarios when a full service cleanup is required.
|
||||
|
||||
## Overview
|
||||
|
||||
When the `MODE_RESET` flag is enabled, the role will:
|
||||
|
||||
1. **Run Once Per Play:** Guarded by `run_once_sys_daemon` to avoid duplicate execution.
|
||||
2. **Identify Service Units:** Finds all `/etc/systemd/system/*{{ SYS_SERVICE_SUFFIX }}` units.
|
||||
3. **Stop and Disable Services:** Gracefully stops and disables matching services.
|
||||
4. **Remove Unit Files:** Deletes the corresponding unit files from the system.
|
||||
5. **Reload systemd:** Ensures the service manager state is updated after cleanup.
|
||||
|
||||
## Purpose
|
||||
|
||||
The main goal of this role is to ensure a clean and consistent state for core daemon services by removing obsolete or stale systemd units.
|
||||
This is particularly useful when re-deploying or performing a full environment reset.
|
||||
|
||||
## Features
|
||||
|
||||
- **Automated Cleanup:** Stops, disables, and removes targeted systemd units.
|
||||
- **Idempotent Execution:** Runs only once per playbook run.
|
||||
- **Configurable Targeting:** Matches services using `SYS_SERVICE_SUFFIX`.
|
||||
- **Systemd Integration:** Reloads daemon state after changes.
|
||||
|
||||
## Further Resources
|
||||
|
||||
- [systemd Service Management](https://www.freedesktop.org/software/systemd/man/systemctl.html)
|
||||
- [Infinito.Nexus License](https://s.infinito.nexus/license)
|
||||
|
||||
## License
|
||||
|
||||
This role is released under the Infinito.Nexus NonCommercial License.
|
||||
See [license details](https://s.infinito.nexus/license)
|
||||
|
||||
## Author Information
|
||||
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
[https://www.veen.world](https://www.veen.world)
|
4
roles/sys-daemon/handlers/main.yml
Normal file
4
roles/sys-daemon/handlers/main.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
- name: "reload system daemon"
|
||||
command: systemctl daemon-reload
|
||||
async: "{{ ASYNC_TIME if ASYNC_ENABLED | bool else omit }}"
|
||||
poll: "{{ ASYNC_POLL if ASYNC_ENABLED | bool else omit }}"
|
19
roles/sys-daemon/meta/main.yml
Normal file
19
roles/sys-daemon/meta/main.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Role to reset and clean up Infinito.Nexus systemd service units for the core daemon."
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
license: "Infinito.Nexus NonCommercial License"
|
||||
license_url: "https://s.infinito.nexus/license"
|
||||
min_ansible_version: "2.9"
|
||||
galaxy_tags:
|
||||
- systemd
|
||||
- cleanup
|
||||
- infinito
|
||||
repository: "https://s.infinito.nexus/code"
|
||||
issue_tracker_url: "https://s.infinito.nexus/issues"
|
||||
documentation: "https://s.infinito.nexus/code/#sys-daemon-role"
|
||||
|
||||
dependencies: []
|
8
roles/sys-daemon/tasks/main.yml
Normal file
8
roles/sys-daemon/tasks/main.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
- name: "reset (if enabled)"
|
||||
include_tasks: reset.yml
|
||||
when: MODE_RESET | bool and run_once_sys_daemon is not defined
|
||||
|
||||
- name: run {{ role_name }} once
|
||||
set_fact:
|
||||
run_once_sys_daemon: true
|
||||
when: run_once_sys_daemon is not defined
|
3
roles/sys-daemon/tasks/reset.yml
Normal file
3
roles/sys-daemon/tasks/reset.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
- name: reload system daemon
|
||||
command: /bin/true
|
||||
notify: "reload system daemon"
|
Reference in New Issue
Block a user