mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-12-22 18:35:03 +01:00
solved health-nginx bugs
This commit is contained in:
parent
1d2f2875b5
commit
0f939e24ce
@ -52,7 +52,7 @@ domains_mastodon_alternates: []
|
||||
domain_matomo: "matomo.{{top_domain}}"
|
||||
domain_mediawiki: "wiki.{{top_domain}}"
|
||||
domain_nextcloud: "cloud.{{top_domain}}"
|
||||
domain_pixelfed: "pictures.{{top_domain}}"
|
||||
domain_pixelfed: "pictures.{{top_domain}}"
|
||||
domains_pixelfed: []
|
||||
domain_peertube: "videos.{{top_domain}}"
|
||||
domains_peertube: []
|
||||
|
@ -12,8 +12,8 @@
|
||||
when: run_once_health_nginx is not defined
|
||||
|
||||
- name: create health-nginx.py
|
||||
copy:
|
||||
src: health-nginx.py
|
||||
template:
|
||||
src: health-nginx.py.j2
|
||||
dest: "{{ health_nginx_folder }}health-nginx.py"
|
||||
when: run_once_health_nginx is not defined
|
||||
|
||||
|
@ -3,13 +3,8 @@ import requests
|
||||
import sys
|
||||
import re
|
||||
|
||||
# Set up argument parser
|
||||
parser = argparse.ArgumentParser(description='Check if domains of nginx configuration files respond with the correct status code.')
|
||||
parser.add_argument('config_path', help='Path to the nginx configuration directory')
|
||||
args = parser.parse_args()
|
||||
|
||||
# Use the provided argument for the config path
|
||||
config_path = args.config_path
|
||||
# file in which fqdn server configs are deposit
|
||||
config_path = {{nginx_servers_directory}}
|
||||
|
||||
# Initialize the error counter
|
||||
error_counter = 0
|
||||
@ -32,11 +27,13 @@ for filename in os.listdir(config_path):
|
||||
|
||||
# Determine expected status codes based on subdomain
|
||||
if len(parts) == 3:
|
||||
if parts[0] == 'listmonk':
|
||||
if parts[0] == '{{domain_listmonk}}':
|
||||
expected_statuses = [401]
|
||||
elif parts[0] == 'www':
|
||||
{% if nginx_matomo_tracking | bool %}
|
||||
elif parts[0] == '{{nginx_www_redirect}}':
|
||||
expected_statuses = [200,301]
|
||||
elif parts[0] == 's':
|
||||
{% endif %}
|
||||
elif parts[0] == '{{domain_yourls}}':
|
||||
expected_statuses = [403]
|
||||
|
||||
try:
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/python3 {{ health_nginx_folder }}health-nginx.py {{nginx_servers_directory}}
|
||||
ExecStart=/usr/bin/python3 {{ health_nginx_folder }}health-nginx.py
|
||||
|
Loading…
Reference in New Issue
Block a user