From 876c93737df49d819a5772e49db087c1f7bcd7b3 Mon Sep 17 00:00:00 2001 From: Julian Labus Date: Tue, 16 Jul 2019 16:15:32 +0200 Subject: [PATCH] Role service-nginx-meshviewer: add additional domains Our meshes structure only supports two domains (internal/external). This adds a list called `meshviewer_additional_domains` which will be prefixed with `map.` and redirected to the main Meshviewer domain. --- inventory/group_vars/monitoring | 3 +++ .../templates/meshviewer_vhost.conf.j2 | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/inventory/group_vars/monitoring b/inventory/group_vars/monitoring index f448055..b52562f 100644 --- a/inventory/group_vars/monitoring +++ b/inventory/group_vars/monitoring @@ -25,3 +25,6 @@ alertmanager_opts: "--web.external-url=https://{{ http_prometheus_prefix }}.{{ h yanic_blacklist: - 98ded0c5e0c0 + +meshviewer_additional_domains: + - freifunk-wiesbaden.de diff --git a/roles/service-nginx-meshviewer/templates/meshviewer_vhost.conf.j2 b/roles/service-nginx-meshviewer/templates/meshviewer_vhost.conf.j2 index 595890a..c8ee8cc 100644 --- a/roles/service-nginx-meshviewer/templates/meshviewer_vhost.conf.j2 +++ b/roles/service-nginx-meshviewer/templates/meshviewer_vhost.conf.j2 @@ -86,3 +86,28 @@ server { {% endif %} {% endif %} {% endfor %} + +{% if meshviewer_additional_domains is defined %} +{% for domain in meshviewer_additional_domains %} +server { + listen 80; + listen [::]:80; + server_name {{ http_meshviewer_prefix }}.{{ domain }}; + return 301 https://{{ http_meshviewer_external }}$request_uri; + + include /etc/nginx/snippets/letsencrypt-acme-challenge.conf; +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + server_name {{ http_meshviewer_prefix }}.{{ domain }}; + return 301 https://{{ http_meshviewer_external }}$request_uri; + + include /etc/nginx/snippets/letsencrypt-acme-challenge.conf; +} +{% if not loop.last %} + +{% endif %} +{% endfor %} +{% endif %}