diff --git a/roles/backup-docker-to-local/meta/main.yml b/roles/backup-docker-to-local/meta/main.yml index 8d6565bd..cd0c75db 100644 --- a/roles/backup-docker-to-local/meta/main.yml +++ b/roles/backup-docker-to-local/meta/main.yml @@ -1,5 +1,5 @@ dependencies: - git - backups-provider - - systemd_notifier + - systemd-notifier - cleanup-failed-docker-backups \ No newline at end of file diff --git a/roles/backup-remote-to-local/meta/main.yml b/roles/backup-remote-to-local/meta/main.yml index 4737a901..28fad1ec 100644 --- a/roles/backup-remote-to-local/meta/main.yml +++ b/roles/backup-remote-to-local/meta/main.yml @@ -1,5 +1,5 @@ dependencies: - git - - systemd_notifier + - systemd-notifier - cleanup-backups-timer - cleanup-failed-docker-backups diff --git a/roles/certbot-nginx/meta/main.yml b/roles/certbot-nginx/meta/main.yml index e7b10f1e..a86fac29 100644 --- a/roles/certbot-nginx/meta/main.yml +++ b/roles/certbot-nginx/meta/main.yml @@ -1,3 +1,3 @@ dependencies: - nginx -- systemd_notifier +- systemd-notifier diff --git a/roles/cleanup-backups-service/meta/main.yml b/roles/cleanup-backups-service/meta/main.yml index 9bc75d41..89688f81 100644 --- a/roles/cleanup-backups-service/meta/main.yml +++ b/roles/cleanup-backups-service/meta/main.yml @@ -1,3 +1,3 @@ dependencies: - python-pip - - systemd_notifier + - systemd-notifier diff --git a/roles/cleanup-disc-space/meta/main.yml b/roles/cleanup-disc-space/meta/main.yml index b001f0d8..5c946b6c 100644 --- a/roles/cleanup-disc-space/meta/main.yml +++ b/roles/cleanup-disc-space/meta/main.yml @@ -1,2 +1,2 @@ dependencies: - - systemd_notifier + - systemd-notifier diff --git a/roles/cleanup-failed-docker-backups/meta/main.yml b/roles/cleanup-failed-docker-backups/meta/main.yml index c4fbe772..260ec638 100644 --- a/roles/cleanup-failed-docker-backups/meta/main.yml +++ b/roles/cleanup-failed-docker-backups/meta/main.yml @@ -1,3 +1,3 @@ dependencies: - git - - systemd_notifier + - systemd-notifier diff --git a/roles/docker-mailu/meta/main.yml b/roles/docker-mailu/meta/main.yml index 05516281..c94762d8 100644 --- a/roles/docker-mailu/meta/main.yml +++ b/roles/docker-mailu/meta/main.yml @@ -1,3 +1,3 @@ dependencies: - nginx-docker-reverse-proxy -- systemd_notifier +- systemd-notifier diff --git a/roles/driver-msi-keyboard-color/meta/main.yml b/roles/driver-msi-keyboard-color/meta/main.yml index 008ee9b4..635c3616 100644 --- a/roles/driver-msi-keyboard-color/meta/main.yml +++ b/roles/driver-msi-keyboard-color/meta/main.yml @@ -9,4 +9,4 @@ galaxy_info: - all dependencies: - system-aur-helper - - systemd_notifier + - systemd-notifier diff --git a/roles/health-btrfs/meta/main.yml b/roles/health-btrfs/meta/main.yml index b001f0d8..5c946b6c 100644 --- a/roles/health-btrfs/meta/main.yml +++ b/roles/health-btrfs/meta/main.yml @@ -1,2 +1,2 @@ dependencies: - - systemd_notifier + - systemd-notifier diff --git a/roles/health-disc-space/meta/main.yml b/roles/health-disc-space/meta/main.yml index b001f0d8..5c946b6c 100644 --- a/roles/health-disc-space/meta/main.yml +++ b/roles/health-disc-space/meta/main.yml @@ -1,2 +1,2 @@ dependencies: - - systemd_notifier + - systemd-notifier diff --git a/roles/health-docker-container/README.md b/roles/health-docker-container/README.md index ce326a76..75a61c75 100644 --- a/roles/health-docker-container/README.md +++ b/roles/health-docker-container/README.md @@ -18,4 +18,4 @@ This Ansible role is designed to ensure the health of Docker containers running To use this role, include it in your playbook and set the `path_administrator_scripts` variable to the desired path for the health check scripts. -Ensure that the `systemd_notifier` dependency is satisfied for error notifications. \ No newline at end of file +Ensure that the `systemd-notifier` dependency is satisfied for error notifications. \ No newline at end of file diff --git a/roles/health-docker-container/meta/main.yml b/roles/health-docker-container/meta/main.yml index b001f0d8..5c946b6c 100644 --- a/roles/health-docker-container/meta/main.yml +++ b/roles/health-docker-container/meta/main.yml @@ -1,2 +1,2 @@ dependencies: - - systemd_notifier + - systemd-notifier diff --git a/roles/health-docker-volumes/README.md b/roles/health-docker-volumes/README.md index 94680cf4..3f3cff27 100644 --- a/roles/health-docker-volumes/README.md +++ b/roles/health-docker-volumes/README.md @@ -18,7 +18,7 @@ This role checks for anonymous Docker volumes that are not bound to a container Include this role in your playbook and set the `path_administrator_scripts` variable to determine where the health check scripts should reside. Define `whitelisted_anonymous_volumes` in `vars/main.yml` with an array of volume IDs that should be ignored by the health check. -Ensure that the `systemd_notifier` dependency is satisfied for error notifications. +Ensure that the `systemd-notifier` dependency is satisfied for error notifications. ## Created with AI This script was created with the help of AI. The full conversation you find [here](https://chat.openai.com/share/1fa829f1-f001-4111-b1d4-1b2e3d583da2). diff --git a/roles/health-docker-volumes/meta/main.yml b/roles/health-docker-volumes/meta/main.yml index b001f0d8..5c946b6c 100644 --- a/roles/health-docker-volumes/meta/main.yml +++ b/roles/health-docker-volumes/meta/main.yml @@ -1,2 +1,2 @@ dependencies: - - systemd_notifier + - systemd-notifier diff --git a/roles/health-journalctl/meta/main.yml b/roles/health-journalctl/meta/main.yml index b001f0d8..5c946b6c 100644 --- a/roles/health-journalctl/meta/main.yml +++ b/roles/health-journalctl/meta/main.yml @@ -1,2 +1,2 @@ dependencies: - - systemd_notifier + - systemd-notifier diff --git a/roles/health-nginx/meta/main.yml b/roles/health-nginx/meta/main.yml index 9bc75d41..89688f81 100644 --- a/roles/health-nginx/meta/main.yml +++ b/roles/health-nginx/meta/main.yml @@ -1,3 +1,3 @@ dependencies: - python-pip - - systemd_notifier + - systemd-notifier diff --git a/roles/systemd_notifier_email/README.md b/roles/systemd-notifier-email/README.md similarity index 86% rename from roles/systemd_notifier_email/README.md rename to roles/systemd-notifier-email/README.md index c9d48ecf..47d37187 100644 --- a/roles/systemd_notifier_email/README.md +++ b/roles/systemd-notifier-email/README.md @@ -1,17 +1,17 @@ -# systemd_notifier_email Ansible Role +# systemd-notifier-email Ansible Role Author: Kevin Veen-Birkenbach (kevin@veen.world) ## Description -This Ansible role installs the necessary components for sending email notifications through systemd when any service fails. It configures the `systemd_notifier_email` service and handles the setup of email parameters and templates. +This Ansible role installs the necessary components for sending email notifications through systemd when any service fails. It configures the `systemd-notifier-email` service and handles the setup of email parameters and templates. Features include: - Installation and configuration of an email sending service. - Customizable email templates for service failure notifications. -This role is part of the `systemd_notifier` suite, which provides a comprehensive solution for service failure notifications in a systemd environment. +This role is part of the `systemd-notifier` suite, which provides a comprehensive solution for service failure notifications in a systemd environment. This role was created as part of a conversation with OpenAI's ChatGPT and can be found [here](https://chat.openai.com/share/96e4ca12-0888-41c0-9cfc-29c0180f0dba). @@ -30,7 +30,7 @@ The following variables can be customized in the role's `vars/main.yml` file: ## Usage -To use this role, include it as a dependency in your playbook or role that requires email notifications. Ensure that the `systemd_notifier_email` role is correctly referenced and configured. +To use this role, include it as a dependency in your playbook or role that requires email notifications. Ensure that the `systemd-notifier-email` role is correctly referenced and configured. ## License diff --git a/roles/systemd-notifier-email/handlers/main.yml b/roles/systemd-notifier-email/handlers/main.yml new file mode 100644 index 00000000..a8763686 --- /dev/null +++ b/roles/systemd-notifier-email/handlers/main.yml @@ -0,0 +1,4 @@ +- name: "restart systemd-notifier-email service" + systemd: + name: systemd-notifier-email.service + daemon_reload: yes diff --git a/roles/systemd-notifier-email/tasks/main.yml b/roles/systemd-notifier-email/tasks/main.yml new file mode 100644 index 00000000..762cb8e8 --- /dev/null +++ b/roles/systemd-notifier-email/tasks/main.yml @@ -0,0 +1,18 @@ +- name: install smtp-forwarder + pacman: name=smtp-forwarder state=present + +- name: configure msmtprc.conf.j2 + template: src=msmtprc.conf.j2 dest=/root/.msmtprc + +- name: "create {{systemd_notifier_email_folder}}" + file: + path: "{{systemd_notifier_email_folder}}" + state: directory + mode: 0755 + +- name: configure systemd-notifier-email.sh + template: src=systemd-notifier-email.sh.j2 dest={{systemd_notifier_email_folder}}systemd-notifier-email.sh + +- name: configure systemd-notifier-email.service + template: src=systemd-notifier-email@.service.j2 dest=/etc/systemd/system/systemd-notifier-email@.service + notify: restart systemd-notifier-email service diff --git a/roles/systemd_notifier_email/templates/msmtprc.conf.j2 b/roles/systemd-notifier-email/templates/msmtprc.conf.j2 similarity index 100% rename from roles/systemd_notifier_email/templates/msmtprc.conf.j2 rename to roles/systemd-notifier-email/templates/msmtprc.conf.j2 diff --git a/roles/systemd_notifier_email/templates/systemd_notifier_email.sh.j2 b/roles/systemd-notifier-email/templates/systemd-notifier-email.sh.j2 similarity index 100% rename from roles/systemd_notifier_email/templates/systemd_notifier_email.sh.j2 rename to roles/systemd-notifier-email/templates/systemd-notifier-email.sh.j2 diff --git a/roles/systemd_notifier_email/templates/systemd_notifier_email@.service.j2 b/roles/systemd-notifier-email/templates/systemd-notifier-email@.service.j2 similarity index 55% rename from roles/systemd_notifier_email/templates/systemd_notifier_email@.service.j2 rename to roles/systemd-notifier-email/templates/systemd-notifier-email@.service.j2 index 7d323698..2f963a6f 100644 --- a/roles/systemd_notifier_email/templates/systemd_notifier_email@.service.j2 +++ b/roles/systemd-notifier-email/templates/systemd-notifier-email@.service.j2 @@ -3,6 +3,6 @@ Description=status email for %i to user [Service] Type=oneshot -ExecStart=/bin/bash {{systemd_notifier_email_folder}}systemd_notifier_email.sh %i +ExecStart=/bin/bash {{systemd_notifier_email_folder}}systemd-notifier-email.sh %i User=root Group=systemd-journal diff --git a/roles/systemd_notifier_email/vars/main.yml b/roles/systemd-notifier-email/vars/main.yml similarity index 74% rename from roles/systemd_notifier_email/vars/main.yml rename to roles/systemd-notifier-email/vars/main.yml index 48833fdc..d47c0719 100644 --- a/roles/systemd_notifier_email/vars/main.yml +++ b/roles/systemd-notifier-email/vars/main.yml @@ -1 +1 @@ -systemd_notifier_email_folder: "{{path_administrator_scripts}}systemd_notifier_email/" \ No newline at end of file +systemd_notifier_email_folder: "{{path_administrator_scripts}}systemd-notifier-email/" \ No newline at end of file diff --git a/roles/systemd_notifier_telegram/README.md b/roles/systemd-notifier-telegram/README.md similarity index 76% rename from roles/systemd_notifier_telegram/README.md rename to roles/systemd-notifier-telegram/README.md index 21b24159..07feed4b 100644 --- a/roles/systemd_notifier_telegram/README.md +++ b/roles/systemd-notifier-telegram/README.md @@ -1,13 +1,13 @@ ## Description -This Ansible role installs the necessary components for sending Telegram notifications through systemd when any service fails. It configures the `systemd_notifier_telegram` service and handles the setup of Telegram bot parameters and notification templates. +This Ansible role installs the necessary components for sending Telegram notifications through systemd when any service fails. It configures the `systemd-notifier-telegram` service and handles the setup of Telegram bot parameters and notification templates. Features include: - Installation and configuration of a Telegram notifier service. - Customizable templates for Telegram messages sent on service failure. -This role is part of the `systemd_notifier` suite, which provides a comprehensive solution for service failure notifications in a systemd environment. +This role is part of the `systemd-notifier` suite, which provides a comprehensive solution for service failure notifications in a systemd environment. ## Requirements @@ -20,14 +20,14 @@ This role has the following requirements: The following variables can be customized in the role's `vars/main.yml` file: -- `systemd_notifier_telegram_folder`: The path to the folder where Telegram-related scripts and configurations will be stored. -- `systemd_notifier_telegram_script`: The full path to the systemd-telegram.sh script. +- `systemd_telegram_folder`: The path to the folder where Telegram-related scripts and configurations will be stored. +- `systemd_telegram_script`: The full path to the systemd-telegram.sh script. This role was created as part of a conversation with OpenAI's ChatGPT and can be found [here](https://chat.openai.com/share/96e4ca12-0888-41c0-9cfc-29c0180f0dba). ## Usage -To use this role, include it as a dependency in your playbook or role that requires Telegram notifications. Ensure that the `systemd_notifier_telegram` role is correctly referenced and configured. +To use this role, include it as a dependency in your playbook or role that requires Telegram notifications. Ensure that the `systemd-notifier-telegram` role is correctly referenced and configured. ## License diff --git a/roles/systemd-notifier-telegram/handlers/main.yml b/roles/systemd-notifier-telegram/handlers/main.yml new file mode 100644 index 00000000..e0271c96 --- /dev/null +++ b/roles/systemd-notifier-telegram/handlers/main.yml @@ -0,0 +1,4 @@ +- name: "restart systemd-notifier-telegram service" + systemd: + name: systemd-notifier-telegram.service + daemon_reload: yes diff --git a/roles/systemd-notifier-telegram/tasks/main.yml b/roles/systemd-notifier-telegram/tasks/main.yml new file mode 100644 index 00000000..beeb44f1 --- /dev/null +++ b/roles/systemd-notifier-telegram/tasks/main.yml @@ -0,0 +1,21 @@ +- name: install curl + pacman: + name: curl + state: present + +- name: Create a directory with a subdirectory + ansible.builtin.file: + path: "{{systemd_telegram_folder}}" + state: directory + mode: '0755' + +- name: configure systemd-notifier-telegram.sh + template: + src: systemd-notifier-telegram.sh.j2 + dest: "{{ systemd_telegram_script }}" + +- name: configure systemd-notifier-telegram.service + template: + src: systemd-notifier-telegram@.service.j2 + dest: "/etc/systemd/system/systemd-notifier-telegram@.service" + notify: "restart systemd-notifier-telegram service" diff --git a/roles/systemd_notifier_telegram/templates/systemd_notifier_telegram.sh.j2 b/roles/systemd-notifier-telegram/templates/systemd-notifier-telegram.sh.j2 similarity index 100% rename from roles/systemd_notifier_telegram/templates/systemd_notifier_telegram.sh.j2 rename to roles/systemd-notifier-telegram/templates/systemd-notifier-telegram.sh.j2 diff --git a/roles/systemd_notifier_telegram/templates/systemd_notifier_telegram@.service.j2 b/roles/systemd-notifier-telegram/templates/systemd-notifier-telegram@.service.j2 similarity index 100% rename from roles/systemd_notifier_telegram/templates/systemd_notifier_telegram@.service.j2 rename to roles/systemd-notifier-telegram/templates/systemd-notifier-telegram@.service.j2 diff --git a/roles/systemd-notifier-telegram/vars/main.yml b/roles/systemd-notifier-telegram/vars/main.yml new file mode 100644 index 00000000..9a014f7d --- /dev/null +++ b/roles/systemd-notifier-telegram/vars/main.yml @@ -0,0 +1,2 @@ +systemd_telegram_folder: "/opt/ansible-roles/systemd-notifier-telegram/" +systemd_telegram_script: "{{systemd_telegram_folder}}systemd-notifier-telegram.sh" diff --git a/roles/systemd_notifier/README.md b/roles/systemd-notifier/README.md similarity index 74% rename from roles/systemd_notifier/README.md rename to roles/systemd-notifier/README.md index 132bcf33..ba1e3bd0 100644 --- a/roles/systemd_notifier/README.md +++ b/roles/systemd-notifier/README.md @@ -1,15 +1,15 @@ -# systemd_notifier Ansible Role +# systemd-notifier Ansible Role Author: Kevin Veen-Birkenbach (kevin@veen.world) ## Description -This Ansible role installs a systemd service that sends notifications via both `systemd_notifier_telegram` and `systemd_notifier_email` when any service fails. +This Ansible role installs a systemd service that sends notifications via both `systemd-notifier-telegram` and `systemd-notifier-email` when any service fails. Features include: - Configuration of a systemd service for notification. -- Dependency management for the `systemd_notifier_telegram` and `systemd_notifier_email` roles. +- Dependency management for the `systemd-notifier-telegram` and `systemd-notifier-email` roles. This role was created as part of a conversation with OpenAI's ChatGPT and can be found [here](https://chat.openai.com/share/96e4ca12-0888-41c0-9cfc-29c0180f0dba). @@ -21,8 +21,8 @@ This Ansible role is licensed under the AGPL v3 License. See the LICENSE file fo This role has the following dependencies: -- `systemd_notifier_telegram` -- `systemd_notifier_email` +- `systemd-notifier-telegram` +- `systemd-notifier-email` ## Features diff --git a/roles/systemd_notifier/handlers/main.yml b/roles/systemd-notifier/handlers/main.yml similarity index 100% rename from roles/systemd_notifier/handlers/main.yml rename to roles/systemd-notifier/handlers/main.yml diff --git a/roles/systemd-notifier/meta/main.yml b/roles/systemd-notifier/meta/main.yml new file mode 100644 index 00000000..dd6d3068 --- /dev/null +++ b/roles/systemd-notifier/meta/main.yml @@ -0,0 +1,4 @@ +--- +dependencies: + - role: systemd-notifier-telegram + - role: systemd-notifier-email diff --git a/roles/systemd_notifier/tasks/main.yml b/roles/systemd-notifier/tasks/main.yml similarity index 100% rename from roles/systemd_notifier/tasks/main.yml rename to roles/systemd-notifier/tasks/main.yml diff --git a/roles/systemd-notifier/templates/systemd-notifier@.service.j2 b/roles/systemd-notifier/templates/systemd-notifier@.service.j2 new file mode 100644 index 00000000..8886a1cf --- /dev/null +++ b/roles/systemd-notifier/templates/systemd-notifier@.service.j2 @@ -0,0 +1,8 @@ +[Unit] +Description=Notifier for %i + +[Service] +Type=oneshot +ExecStart=/usr/bin/systemctl start systemd-notifier-telegram@%i.service systemd-notifier-email@%i.service +User=root +Group=systemd-journal diff --git a/roles/systemd_notifier/meta/main.yml b/roles/systemd_notifier/meta/main.yml deleted file mode 100644 index 2399c811..00000000 --- a/roles/systemd_notifier/meta/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -dependencies: - - role: systemd_notifier_telegram - - role: systemd_notifier_email diff --git a/roles/systemd_notifier/templates/systemd-notifier@.service.j2 b/roles/systemd_notifier/templates/systemd-notifier@.service.j2 deleted file mode 100644 index ee48fbf8..00000000 --- a/roles/systemd_notifier/templates/systemd-notifier@.service.j2 +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Notifier for %i - -[Service] -Type=oneshot -ExecStart=/usr/bin/systemctl start systemd_notifier_telegram@%i.service systemd_notifier_email@%i.service -User=root -Group=systemd-journal diff --git a/roles/systemd_notifier_email/handlers/main.yml b/roles/systemd_notifier_email/handlers/main.yml deleted file mode 100644 index a9d7c24a..00000000 --- a/roles/systemd_notifier_email/handlers/main.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: "restart systemd_notifier_email service" - systemd: - name: systemd_notifier_email.service - daemon_reload: yes diff --git a/roles/systemd_notifier_email/tasks/main.yml b/roles/systemd_notifier_email/tasks/main.yml deleted file mode 100644 index 62c067e0..00000000 --- a/roles/systemd_notifier_email/tasks/main.yml +++ /dev/null @@ -1,18 +0,0 @@ -- name: install smtp-forwarder - pacman: name=smtp-forwarder state=present - -- name: configure msmtprc.conf.j2 - template: src=msmtprc.conf.j2 dest=/root/.msmtprc - -- name: "create {{systemd_notifier_email_folder}}" - file: - path: "{{systemd_notifier_email_folder}}" - state: directory - mode: 0755 - -- name: configure systemd_notifier_email.sh - template: src=systemd_notifier_email.sh.j2 dest={{systemd_notifier_email_folder}}systemd_notifier_email.sh - -- name: configure systemd_notifier_email.service - template: src=systemd_notifier_email@.service.j2 dest=/etc/systemd/system/systemd_notifier_email@.service - notify: restart systemd_notifier_email service diff --git a/roles/systemd_notifier_telegram/handlers/main.yml b/roles/systemd_notifier_telegram/handlers/main.yml deleted file mode 100644 index d8cf8272..00000000 --- a/roles/systemd_notifier_telegram/handlers/main.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: "restart systemd_notifier_telegram service" - systemd: - name: systemd_notifier_telegram.service - daemon_reload: yes diff --git a/roles/systemd_notifier_telegram/tasks/main.yml b/roles/systemd_notifier_telegram/tasks/main.yml deleted file mode 100644 index 0e05ac6c..00000000 --- a/roles/systemd_notifier_telegram/tasks/main.yml +++ /dev/null @@ -1,21 +0,0 @@ -- name: install curl - pacman: - name: curl - state: present - -- name: Create a directory with a subdirectory - ansible.builtin.file: - path: "{{systemd_telegram_folder}}" - state: directory - mode: '0755' - -- name: configure systemd_notifier_telegram.sh - template: - src: systemd_notifier_telegram.sh.j2 - dest: "{{ systemd_telegram_script }}" - -- name: configure systemd_notifier_telegram.service - template: - src: systemd_notifier_telegram@.service.j2 - dest: "/etc/systemd/system/systemd_notifier_telegram@.service" - notify: "restart systemd_notifier_telegram service" diff --git a/roles/systemd_notifier_telegram/vars/main.yml b/roles/systemd_notifier_telegram/vars/main.yml deleted file mode 100644 index f958ecec..00000000 --- a/roles/systemd_notifier_telegram/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -systemd_telegram_folder: "/opt/ansible-roles/systemd_notifier_telegram/" -systemd_telegram_script: "{{systemd_telegram_folder}}systemd_notifier_telegram.sh"