mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-30 23:38:13 +02:00
Refactor systemctl services and categories due to alarm bugs
This commit restructures systemctl service definitions and category mappings. Motivation: Alarm-related bugs revealed inconsistencies in service and role handling. Preparation step: lays the groundwork for fixing the alarm issues by aligning categories, roles, and service templates.
This commit is contained in:
20
roles/sys-ctl-alm-compose/README.md
Normal file
20
roles/sys-ctl-alm-compose/README.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Unified Service Failure Notifier
|
||||
|
||||
## Description
|
||||
|
||||
This role installs a systemd service that sends notifications via both [sys-ctl-alm-telegram](../sys-ctl-alm-telegram/README.md) and [sys-ctl-alm-email](../sys-ctl-alm-email/README.md) when any service fails.
|
||||
|
||||
## Overview
|
||||
|
||||
Optimized for prompt and comprehensive failure alerts, this role configures a unified notification service. It leverages the capabilities of both Telegram and Email notifications to ensure that administrators are quickly informed about service issues, enabling rapid troubleshooting.
|
||||
|
||||
## Purpose
|
||||
|
||||
The primary purpose of this role is to provide a centralized mechanism for service failure notifications. By integrating with both the Telegram and Email notifier roles, it delivers reliable alerts through multiple channels, enhancing overall system observability and responsiveness.
|
||||
|
||||
## Features
|
||||
|
||||
- **Unified Notification Service:** Installs a systemd service that triggers both Telegram and Email alerts.
|
||||
- **Dependency Integration:** Works seamlessly with the [sys-ctl-alm-telegram](../sys-ctl-alm-telegram/README.md) and [sys-ctl-alm-email](../sys-ctl-alm-email/README.md) roles.
|
||||
- **Automated Service Management:** Automatically restarts the notifier service upon configuration changes.
|
||||
- **Centralized Alerting:** Provides a unified approach to monitor and notify about service failures.
|
5
roles/sys-ctl-alm-compose/handlers/main.yml
Normal file
5
roles/sys-ctl-alm-compose/handlers/main.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
- name: "restart sys-ctl-alm-compose service"
|
||||
systemd:
|
||||
name: "{{ SYS_SERVICE_ALARM_CMP }}"
|
||||
daemon_reload: yes
|
||||
when: run_once_sys_ctl_alm_compose is not defined
|
23
roles/sys-ctl-alm-compose/meta/main.yml
Normal file
23
roles/sys-ctl-alm-compose/meta/main.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
galaxy_info:
|
||||
author: "Kevin Veen-Birkenbach"
|
||||
description: "Installs a unified systemd notification service that sends alerts via both Telegram and Email when a service fails."
|
||||
license: "Infinito.Nexus NonCommercial License"
|
||||
license_url: "https://s.infinito.nexus/license"
|
||||
company: |
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
- name: Archlinux
|
||||
versions:
|
||||
- rolling
|
||||
galaxy_tags:
|
||||
- systemd
|
||||
- notifier
|
||||
- telegram
|
||||
- email
|
||||
- notifications
|
||||
repository: "https://s.infinito.nexus/code"
|
||||
issue_tracker_url: "https://s.infinito.nexus/issues"
|
||||
documentation: "https://docs.infinito.nexus"
|
14
roles/sys-ctl-alm-compose/tasks/main.yml
Normal file
14
roles/sys-ctl-alm-compose/tasks/main.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
- block:
|
||||
- name: Include dependencies
|
||||
include_role:
|
||||
name: '{{ item }}'
|
||||
loop:
|
||||
- sys-ctl-alm-telegram
|
||||
- sys-ctl-alm-email
|
||||
- name: "setup '{{ SYS_SERVICE_ALARM_CMP }}'"
|
||||
template:
|
||||
src: sys-ctl-alm-compose@.service.j2
|
||||
dest: "/etc/systemd/system/{{ SYS_SERVICE_ALARM_CMP }}"
|
||||
notify: "restart sys-ctl-alm-compose service"
|
||||
- include_tasks: utils/run_once.yml
|
||||
when: run_once_sys_ctl_alm_compose is not defined
|
@@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Notifier for %i
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/systemctl start sys-ctl-alm-telegram.infinito@%i.service sys-ctl-alm-email.infinito@%i.service
|
||||
User=root
|
||||
Group=systemd-journal
|
Reference in New Issue
Block a user