mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-09-07 18:57:12 +02:00
Replaced .infinito.service and .infinito.timer by SOFTWARE_NAME suffix, optimized LICENSE link and update OIDC Realm and ID conf
This commit is contained in:
@@ -1,21 +1,26 @@
|
||||
# Health Check for Docker Containers
|
||||
# Docker Container Health Check
|
||||
|
||||
## Description
|
||||
|
||||
This Ansible role is designed to ensure the health of Docker containers running on a system. It includes a script that checks for unhealthy or exited Docker containers and sets up a systemd service and timer to regularly execute this check.
|
||||
This role monitors the health status of Docker containers on the system. It detects containers that are either **unhealthy** or have **exited with a non-zero code**, and triggers alerts if issues are found.
|
||||
|
||||
## Files
|
||||
## Overview
|
||||
|
||||
- `vars/main.yml`: Variable definitions for the script's directory.
|
||||
- `handlers/main.yml`: Handlers to reload and restart the systemd service and timer.
|
||||
- `files/sys-hlth-docker-container.sh`: The script that checks the container health.
|
||||
- `tasks/main.yml`: Tasks to create necessary directories, copy scripts, and create systemd service and timer.
|
||||
- `templates/sys-hlth-docker-container.infinito.service.j2`: Systemd service template.
|
||||
- `templates/sys-hlth-docker-container.infinito.timer.j2`: Systemd timer template.
|
||||
- `meta/main.yml`: Meta information declaring dependencies for the role.
|
||||
The role installs a health check script along with a `systemd` service and timer to run these checks at scheduled intervals.
|
||||
If unhealthy or failed containers are detected, the configured failure notifier (via `sys-alm-compose`) is triggered.
|
||||
|
||||
## Usage
|
||||
## Purpose
|
||||
|
||||
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.
|
||||
The primary purpose of this role is to ensure that Docker-based services remain operational. By automatically monitoring container health, it enables administrators to react quickly to failures, reducing downtime and preventing unnoticed service degradation.
|
||||
|
||||
Ensure that the `sys-alm-compose` dependency is satisfied for error notifications.
|
||||
## Features
|
||||
|
||||
- **Automated Health Checks:** Detects containers in `unhealthy` state or exited with non-zero exit codes.
|
||||
- **Systemd Integration:** Installs a one-shot service and timer to run health checks on a schedule.
|
||||
- **Alerting Support:** Works with the [`sys-alm-compose`](../sys-alm-compose/README.md) role for failure notifications.
|
||||
- **Configurable Script Location:** Controlled via the `path_administrator_scripts` variable.
|
||||
|
||||
## Further Resources
|
||||
|
||||
- [Docker Health Checks Documentation](https://docs.docker.com/engine/reference/run/#healthcheck)
|
||||
- [Systemd Timers Documentation](https://www.freedesktop.org/software/systemd/man/systemd.timer.html)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
- name: "reload sys-hlth-docker-container.infinito.service"
|
||||
- name: "reload sys-hlth-docker-container service"
|
||||
systemd:
|
||||
name: sys-hlth-docker-container.infinito.service
|
||||
name: sys-hlth-docker-container{{ SYS_SERVICE_SUFFIX }}
|
||||
enabled: yes
|
||||
daemon_reload: yes
|
||||
|
@@ -5,7 +5,7 @@ galaxy_info:
|
||||
Kevin Veen-Birkenbach
|
||||
Consulting & Coaching Solutions
|
||||
https://www.veen.world
|
||||
license: "Infinito.Nexus NonCommercial License (CNCL)"
|
||||
license: "Infinito.Nexus NonCommercial License"
|
||||
license_url: "https://s.infinito.nexus/license"
|
||||
min_ansible_version: "2.9"
|
||||
platforms:
|
||||
|
@@ -14,11 +14,11 @@
|
||||
src: sys-hlth-docker-container.sh
|
||||
dest: "{{health_docker_container_folder}}sys-hlth-docker-container.sh"
|
||||
|
||||
- name: create sys-hlth-docker-container.infinito.service
|
||||
- name: create sys-hlth-docker-container{{ SYS_SERVICE_SUFFIX }}
|
||||
template:
|
||||
src: sys-hlth-docker-container.service.j2
|
||||
dest: /etc/systemd/system/sys-hlth-docker-container.infinito.service
|
||||
notify: reload sys-hlth-docker-container.infinito.service
|
||||
dest: /etc/systemd/system/sys-hlth-docker-container{{ SYS_SERVICE_SUFFIX }}
|
||||
notify: reload sys-hlth-docker-container service
|
||||
|
||||
- name: "set 'service_name' to '{{ role_name }}'"
|
||||
set_fact:
|
||||
|
Reference in New Issue
Block a user