Merged client playbook and server playbook

This commit is contained in:
2023-04-18 14:52:43 +02:00
parent 2c76f99dd1
commit ec0dbee7bb
341 changed files with 153 additions and 811 deletions

View File

@@ -0,0 +1,2 @@
# journalctl-health-check
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,12 @@
- name: "reload journalctl-health-check.service"
systemd:
name: journalctl-health-check.service
state: reloaded
enabled: yes
daemon_reload: yes
- name: "restart journalctl-health-check.timer"
systemd:
name: journalctl-health-check.timer
state: restarted
enabled: yes
daemon_reload: yes

View File

@@ -0,0 +1,2 @@
dependencies:
- native-systemd-email

View File

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

View File

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

View File

@@ -0,0 +1,10 @@
[Unit]
Description=starts journalctl-health-check.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: "/home/administrator/scripts/journalctl-health-check/"