From e4c380b2b5f05e0c66282756c90519ac5d0e165f Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Tue, 12 Dec 2023 12:52:58 +0100 Subject: [PATCH] Solved some variable bugs --- playbook-servers.yml | 2 +- roles/health-nginx/files/health-nginx.py | 9 +++++++-- roles/health-nginx/templates/health-nginx.service.j2 | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/playbook-servers.yml b/playbook-servers.yml index f5ccaa90..62162bdf 100644 --- a/playbook-servers.yml +++ b/playbook-servers.yml @@ -187,7 +187,7 @@ roles: - role: docker-listmonk vars: - domain: "{{domain_newsletter}}" + domain: "{{domain_listmonk}}" http_port: 8019 - name: setup discourse diff --git a/roles/health-nginx/files/health-nginx.py b/roles/health-nginx/files/health-nginx.py index 373f28e8..ee9b374a 100644 --- a/roles/health-nginx/files/health-nginx.py +++ b/roles/health-nginx/files/health-nginx.py @@ -3,8 +3,13 @@ import requests import sys import re -# Define the path to the nginx configuration directory -config_path = '{{nginx_servers_directory}}' +# 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 # Initialize the error counter error_counter = 0 diff --git a/roles/health-nginx/templates/health-nginx.service.j2 b/roles/health-nginx/templates/health-nginx.service.j2 index e17335ed..20cbc9c1 100644 --- a/roles/health-nginx/templates/health-nginx.service.j2 +++ b/roles/health-nginx/templates/health-nginx.service.j2 @@ -4,4 +4,4 @@ OnFailure=systemd-notifier@%n.service [Service] Type=oneshot -ExecStart=/usr/bin/python3 {{ health_nginx_folder }}health-nginx.py +ExecStart=/usr/bin/python3 {{ health_nginx_folder }}health-nginx.py {{nginx_servers_directory}}