Another big round of refactoring and cleaning...

This commit is contained in:
2025-07-11 17:55:26 +02:00
parent aa61bf2a44
commit 168c5c0da6
323 changed files with 761 additions and 811 deletions

View File

@@ -0,0 +1,24 @@
# Core Daemon Role
This Ansible role handles resetting and cleaning up “CyMaIS” systemd service units for the core daemon.
## Description
When enabled via the `mode_reset` flag, this role will:
1. Run its reset tasks exactly once per play (`run_once_core_daemon` guard).
2. Find all `/etc/systemd/system/*.cymais.service` units.
3. Stop and disable each unit.
4. Remove the unit files.
5. Reload the systemd daemon.
## License
This role is released under the CyMaIS NonCommercial License (CNCL).
See [license details](https://s.veen.world/cncl)
## Author Information
Kevin Veen-Birkenbach
Consulting & Coaching Solutions
[https://www.veen.world](https://www.veen.world)

View File

@@ -0,0 +1,19 @@
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Role to reset and clean up CyMaIS systemd service units for the core daemon."
company: |
Kevin Veen-Birkenbach
Consulting & Coaching Solutions
https://www.veen.world
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
min_ansible_version: "2.9"
galaxy_tags:
- systemd
- cleanup
- cymais
repository: "https://github.com/kevinveenbirkenbach/cymais"
issue_tracker_url: "https://github.com/kevinveenbirkenbach/cymais/issues"
documentation: "https://github.com/kevinveenbirkenbach/cymais/#sys-rst-daemon-role"
dependencies: []

View File

@@ -0,0 +1,8 @@
- name: "reset (if enabled)"
include_tasks: reset.yml
when: mode_reset | bool and run_once_core_daemon is not defined
- name: run {{ role_name }} once
set_fact:
run_once_core_daemon: true
when: run_once_core_daemon is not defined

View File

@@ -0,0 +1,28 @@
- name: Find all cymais.service units
find:
paths: /etc/systemd/system
patterns: '*.cymais.service'
register: cymais_services
- name: Disable and stop each cymais service
become: true
systemd:
name: "{{ item.path | basename }}"
enabled: no
state: stopped
loop: "{{ cymais_services.files }}"
loop_control:
label: "{{ item.path | basename }}"
- name: Remove all cymais.service files
become: true
file:
path: "{{ item.path }}"
state: absent
loop: "{{ cymais_services.files }}"
loop_control:
label: "{{ item.path | basename }}"
- name: Reload systemd daemon
become: true
command: systemctl daemon-reload