Renamed health services

This commit is contained in:
2023-11-16 15:32:29 +01:00
parent 04f69aefde
commit d9d6c8060a
47 changed files with 162 additions and 162 deletions

View File

@@ -0,0 +1,2 @@
# health-journalctl
Checks journalctl for error messages

View File

@@ -0,0 +1,10 @@
#!/bin/sh
echo "Checking journalctl for error messages..."
journalctl_errors="$(journalctl --since '1 day ago' --no-pager | grep -i 'error')"
if [ ! -z "$journalctl_errors" ]
then
echo "Some errors where found: $journalctl_errors"
exit 1
fi
echo "All docker containers are healthy."
exit 0

View File

@@ -0,0 +1,13 @@
- name: "reload health-journalctl.service"
systemd:
name: health-journalctl.service
state: reloaded
enabled: yes
daemon_reload: yes
ignore_errors: true
- name: "restart health-journalctl.timer"
systemd:
name: health-journalctl.timer
state: restarted
enabled: yes
daemon_reload: yes

View File

@@ -0,0 +1,2 @@
dependencies:
- systemd_notifier

View File

@@ -0,0 +1,22 @@
- name: "create {{journalctl_health_check_folder}}"
file:
path: "{{journalctl_health_check_folder}}"
state: directory
mode: 0755
- name: create health-journalctl.sh
copy:
src: health-journalctl.sh
dest: "{{journalctl_health_check_folder}}health-journalctl.sh"
- name: create health-journalctl.service
template:
src: health-journalctl.service.j2
dest: /etc/systemd/system/health-journalctl.service
notify: reload health-journalctl.service
- name: create health-journalctl.timer
template:
src: health-journalctl.timer.j2
dest: /etc/systemd/system/health-journalctl.timer
notify: restart health-journalctl.timer

View File

@@ -0,0 +1,7 @@
[Unit]
Description=checking journalctl health
OnFailure=systemd-notifier@%n.service
[Service]
Type=oneshot
ExecStart=/bin/bash {{journalctl_health_check_folder}}health-journalctl.sh

View File

@@ -0,0 +1,10 @@
[Unit]
Description=starts health-journalctl.service
[Timer]
OnCalendar={{on_calendar_journalctl_health_check}}
RandomizedDelaySec={{randomized_delay_sec}}
Persistent=false
[Install]
WantedBy=timers.target

View File

@@ -0,0 +1 @@
journalctl_health_check_folder: "{{path_administrator_scripts}}health-journalctl/"