mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Merged client playbook and server playbook
This commit is contained in:
2
roles/server_native-journalctl-health-check/README.md
Normal file
2
roles/server_native-journalctl-health-check/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# journalctl-health-check
|
||||
Checks journalctl for error messages
|
@@ -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
|
@@ -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
|
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
- native-systemd-email
|
22
roles/server_native-journalctl-health-check/tasks/main.yml
Normal file
22
roles/server_native-journalctl-health-check/tasks/main.yml
Normal 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
|
@@ -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
|
@@ -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
|
@@ -0,0 +1 @@
|
||||
journalctl_health_check_folder: "/home/administrator/scripts/journalctl-health-check/"
|
Reference in New Issue
Block a user