From 51f883fd963c8bd1b7e7ab283b1f6775d7c94577 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Fri, 22 May 2020 21:22:06 +0200 Subject: [PATCH] add maps to vhost template --- defaults/main.yml | 6 ++++++ templates/etc/nginx/sites-available/vhost.j2 | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 7e2fc8b..7d24027 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -117,6 +117,12 @@ nginx_vhosts_default: # dhparam: # client_max_body_size: # send_timeout: +# maps: +# - input: $input +# output: $output +# parameters: +# - "default 0" +# - "/old/path /new_path" # locations: # - match: / # root: /var/www/vhosts/default diff --git a/templates/etc/nginx/sites-available/vhost.j2 b/templates/etc/nginx/sites-available/vhost.j2 index 2983be8..842ad34 100644 --- a/templates/etc/nginx/sites-available/vhost.j2 +++ b/templates/etc/nginx/sites-available/vhost.j2 @@ -37,7 +37,17 @@ server { {% if server.send_timeout is defined and server.send_timeout %} send_timeout {{ server.send_timeout }}; {% endif %} + {% if server.maps is defined and server.maps %} + {% for map in server.maps %} + map {{ map.input }} {{ map.output }} { + {% for param in map.parameters %} + {{ param }}; + {% endfor %} + } + {% endfor %} + + {% endif %} {% for location in server.locations %} location {{ location.match }} { {% if location.root is defined and location.root %}