Added .cymais.service suffix to make cymais files more visible

This commit is contained in:
2024-01-10 11:18:38 +01:00
parent f3ce00dca7
commit b7e3a7f838
68 changed files with 144 additions and 132 deletions

View File

@@ -26,11 +26,11 @@ This role depends on:
## Usage
1. **Installation of Python Modules**: The role installs the required Python `requests` module.
2. **File and Directory Management**: It creates the necessary directories and files, including the `health-nginx.py` script.
3. **Service and Timer Templates**: Templates for `health-nginx.service` and `health-nginx.timer` are set up to automate the health checks.
3. **Service and Timer Templates**: Templates for `health-nginx.cymais.service` and `health-nginx.timer` are set up to automate the health checks.
4. **Running the Health Check**: The `health-nginx.py` script is executed to perform the health check. It iterates over nginx configuration files and sends a HEAD request to each domain/subdomain to verify its status. The script considers different expected status codes based on the domain or subdomain.
## Handler Details
- **reload health-nginx.service**: Reloads the `health-nginx.service` if there are any changes to the service file.
- **reload health-nginx.cymais.service**: Reloads the `health-nginx.cymais.service` if there are any changes to the service file.
- **restart health-nginx.timer**: Restarts and enables the `health-nginx.timer` to schedule regular health checks.
## Additional Information

View File

@@ -1,5 +1,5 @@
- name: "reload health-nginx.service"
- name: "reload health-nginx.cymais.service"
systemd:
name: health-nginx.service
name: health-nginx.cymais.service
enabled: yes
daemon_reload: yes

View File

@@ -17,11 +17,11 @@
dest: "{{ health_nginx_folder }}health-nginx.py"
when: run_once_health_nginx is not defined
- name: create health-nginx.service
- name: create health-nginx.cymais.service
template:
src: health-nginx.service.j2
dest: /etc/systemd/system/health-nginx.service
notify: reload health-nginx.service
dest: /etc/systemd/system/health-nginx.cymais.service
notify: reload health-nginx.cymais.service
when: run_once_health_nginx is not defined
- name: set service_name to the name of the current role

View File

@@ -1,6 +1,6 @@
[Unit]
Description=Check nginx configuration status
OnFailure=systemd-notifier@%n.service
OnFailure=systemd-notifier.cymais@%n.service
[Service]
Type=oneshot