mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-22 04:31:13 +01:00
solved health-nginx bugs
This commit is contained in:
parent
28b9e741e4
commit
ca96808208
@ -52,7 +52,7 @@ domains_mastodon_alternates: []
|
|||||||
domain_matomo: "matomo.{{top_domain}}"
|
domain_matomo: "matomo.{{top_domain}}"
|
||||||
domain_mediawiki: "wiki.{{top_domain}}"
|
domain_mediawiki: "wiki.{{top_domain}}"
|
||||||
domain_nextcloud: "cloud.{{top_domain}}"
|
domain_nextcloud: "cloud.{{top_domain}}"
|
||||||
domain_pixelfed: "pictures.{{top_domain}}"
|
domain_pixelfed: "pictures.{{top_domain}}"
|
||||||
domains_pixelfed: []
|
domains_pixelfed: []
|
||||||
domain_peertube: "videos.{{top_domain}}"
|
domain_peertube: "videos.{{top_domain}}"
|
||||||
domains_peertube: []
|
domains_peertube: []
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
when: run_once_health_nginx is not defined
|
when: run_once_health_nginx is not defined
|
||||||
|
|
||||||
- name: create health-nginx.py
|
- name: create health-nginx.py
|
||||||
copy:
|
template:
|
||||||
src: health-nginx.py
|
src: health-nginx.py.j2
|
||||||
dest: "{{ health_nginx_folder }}health-nginx.py"
|
dest: "{{ health_nginx_folder }}health-nginx.py"
|
||||||
when: run_once_health_nginx is not defined
|
when: run_once_health_nginx is not defined
|
||||||
|
|
||||||
|
@ -3,13 +3,8 @@ import requests
|
|||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# Set up argument parser
|
# file in which fqdn server configs are deposit
|
||||||
parser = argparse.ArgumentParser(description='Check if domains of nginx configuration files respond with the correct status code.')
|
config_path = {{nginx_servers_directory}}
|
||||||
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
|
|
||||||
|
|
||||||
# Initialize the error counter
|
# Initialize the error counter
|
||||||
error_counter = 0
|
error_counter = 0
|
||||||
@ -32,11 +27,13 @@ for filename in os.listdir(config_path):
|
|||||||
|
|
||||||
# Determine expected status codes based on subdomain
|
# Determine expected status codes based on subdomain
|
||||||
if len(parts) == 3:
|
if len(parts) == 3:
|
||||||
if parts[0] == 'listmonk':
|
if parts[0] == '{{domain_listmonk}}':
|
||||||
expected_statuses = [401]
|
expected_statuses = [401]
|
||||||
elif parts[0] == 'www':
|
{% if nginx_matomo_tracking | bool %}
|
||||||
|
elif parts[0] == '{{nginx_www_redirect}}':
|
||||||
expected_statuses = [200,301]
|
expected_statuses = [200,301]
|
||||||
elif parts[0] == 's':
|
{% endif %}
|
||||||
|
elif parts[0] == '{{domain_yourls}}':
|
||||||
expected_statuses = [403]
|
expected_statuses = [403]
|
||||||
|
|
||||||
try:
|
try:
|
@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
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