mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 15:06:26 +02:00
Another big round of refactoring and cleaning...
This commit is contained in:
24
roles/sys-rst-daemon/README.md
Normal file
24
roles/sys-rst-daemon/README.md
Normal 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)
|
19
roles/sys-rst-daemon/meta/main.yml
Normal file
19
roles/sys-rst-daemon/meta/main.yml
Normal 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: []
|
8
roles/sys-rst-daemon/tasks/main.yml
Normal file
8
roles/sys-rst-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_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
|
28
roles/sys-rst-daemon/tasks/reset.yml
Normal file
28
roles/sys-rst-daemon/tasks/reset.yml
Normal 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
|
Reference in New Issue
Block a user