From c8d9c936c0a0cf0b1bbc645a7bb535cf34d0080e Mon Sep 17 00:00:00 2001 From: Chris Croome <chris@webarchitects.co.uk> Date: Thu, 21 Dec 2023 13:35:22 +0000 Subject: [PATCH] webarch.conf template vars fixed --- .gitlab-ci.yml | 3 +++ .pre-commit-config.yaml | 2 +- meta/argument_specs.yml | 12 ++++++++++++ templates/webarch.conf.j2 | 28 ++++++++++++++-------------- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bcad97c..f971fc0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,11 +14,14 @@ variables: ANSIBLE_FORCE_COLOR: "1" ANSIBLE_REMOTE_TMP: "/tmp" ANSIBLE_SHELL_ALLOW_WORLD_READABLE_TEMP: "1" + DEBIAN_FRONTEND: noninteractive + DEFAULT_MANAGED_STR: "Ansible managed" MOLECULE_VERBOSITY: "0" PY_COLORS: "1" before_script: - whoami - pwd + - chmod 700 $(pwd) - which ansible - ansible --version - which yamllint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a89861..5dee5ed 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: language: python additional_dependencies: # https://github.com/kellyjonbrazil/jc/releases - - jc==1.23.6 + - jc==1.24.0 # https://github.com/jmespath/jmespath.py/tags - jmespath==1.0.1 # https://github.com/jackdewinter/pymarkdown/releases diff --git a/meta/argument_specs.yml b/meta/argument_specs.yml index e3963bf..b39dc09 100644 --- a/meta/argument_specs.yml +++ b/meta/argument_specs.yml @@ -80,6 +80,10 @@ argument_specs: type: int required: true description: The port that Apache should listen on the localhost. + apache_matomo_domain: + type: str + required: false + description: An optional Matomo domain name for the webarch.conf template. apache_md_private_keys: type: list elements: str @@ -159,6 +163,14 @@ argument_specs: type: str required: false description: Internal variable for the PHP version. + apache_phpmyadmin_domain: + type: str + required: false + description: Optional phpMyAdmin domain name for the webarch.conf template. + apache_phpmyadmin_path: + type: str + required: false + description: Optional phpMyAdmin path for the webarch.conf template. apache_pkgs_absent: type: list elements: str diff --git a/templates/webarch.conf.j2 b/templates/webarch.conf.j2 index 2363413..3cc99f4 100644 --- a/templates/webarch.conf.j2 +++ b/templates/webarch.conf.j2 @@ -25,16 +25,16 @@ Alias /icons /usr/share/apache2/icons {% if apache_conf_enabled is defined and "phpmyadmin" in apache_conf_enabled %} SetEnv PHPMYADMIN_DOMAIN "{{ inventory_hostname }}" SetEnv PHPMYADMIN_PATH "/phpmyadmin/" -{% elif phpmyadmin_domain is defined %} -SetEnv PHPMYADMIN_DOMAIN "{{ phpmyadmin_domain }}" -{% if phpmyadmin_path is defined %} -SetEnv PHPMYADMIN_PATH "{{ phpmyadmin_path }}" +{% elif apache_phpmyadmin_domain is defined %} +SetEnv PHPMYADMIN_DOMAIN "{{ apache_phpmyadmin_domain }}" +{% if apache_phpmyadmin_path is defined %} +SetEnv PHPMYADMIN_PATH "{{ apache_phpmyadmin_path }}" {% else %} SetEnv PHPMYADMIN_PATH "/" {% endif %} {% endif %} -{% if matomo_domain is defined %} -SetEnv PIWIK_DOMAIN "{{ matomo_domain }}" +{% if apache_matomo_domain is defined %} +SetEnv PIWIK_DOMAIN "{{ apache_matomo_domain }}" {% endif %} SetEnv HOME_DOMAIN "webarch.net" SetEnv SITE_TITLE "Webarchitects Shared Hosting" @@ -135,9 +135,9 @@ ErrorDocument 506 /wsh/506.shtml SuexecUserGroup www-data www-data </IfModule> ServerAdmin support@webarch.net - {%- if matomo_domain is defined %} + {%- if apache_matomo_domain is defined %} SetEnv PIWIK_SITE_ID "1" - SetEnv PIWIK_SITE_DOMAIN "{{ matomo_domain }}" + SetEnv PIWIK_SITE_DOMAIN "{{ apache_matomo_domain }}" {%- elif matomo_user is defined %} SetEnv PIWIK_SITE_ID "1" SetEnv PIWIK_SITE_DOMAIN "stats.{{ inventory_hostname }}" @@ -145,11 +145,11 @@ ErrorDocument 506 /wsh/506.shtml DocumentRoot "/var/www/wsh" {% if apache_conf_enabled is defined and "phpmyadmin" in apache_conf_enabled %} RedirectPermanent /phpmyadmin https://{{ inventory_hostname }}/phpmyadmin -{% elif phpmyadmin_domain is defined %} -{% if phpmyadmin_path is defined %} - RedirectPermanent /phpmyadmin https://{{ phpmyadmin_domain }}{{ phpmyadmin_path }} +{% elif apache_phpmyadmin_domain is defined %} +{% if apache_phpmyadmin_path is defined %} + RedirectPermanent /phpmyadmin https://{{ apache_phpmyadmin_domain }}{{ apache_phpmyadmin_path }} {% else %} - RedirectPermanent /phpmyadmin https://{{ phpmyadmin_domain }} + RedirectPermanent /phpmyadmin https://{{ apache_phpmyadmin_domain }} {% endif %} {% endif %} <IfModule ssl_module> @@ -186,9 +186,9 @@ ErrorDocument 506 /wsh/506.shtml SuexecUserGroup www-data www-data </IfModule> ServerAdmin "{{ apache_server_admin }}" - {%- if matomo_domain is defined %} + {%- if apache_matomo_domain is defined %} SetEnv PIWIK_SITE_ID "1" - SetEnv PIWIK_SITE_DOMAIN "{{ matomo_domain }}" + SetEnv PIWIK_SITE_DOMAIN "{{ apache_matomo_domain }}" {%- elif matomo_user is defined %} SetEnv PIWIK_SITE_ID "1" SetEnv PIWIK_SITE_DOMAIN "stats.{{ inventory_hostname }}" -- GitLab