From 9903011ba92d1c9b4dc633681760e920c062da4d Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Thu, 19 Aug 2021 09:55:49 +0200 Subject: [PATCH] updated nginx state --- states/nginx/config.sls | 2 +- states/nginx/map.jinja | 2 +- states/nginx/templates/access.j2 | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/states/nginx/config.sls b/states/nginx/config.sls index 5b87d72..821bb69 100644 --- a/states/nginx/config.sls +++ b/states/nginx/config.sls @@ -51,7 +51,7 @@ nginx-sites-available-{{ key }}: proxy_pass: {{ vhost.proxy_pass|default("") }} cache: {{ vhost.cache|default(true) }} autoindex: {{ vhost.autoindex|default(false) }} - root_dir: {{ vhost.root_dir|default(None) }} + root_dir: {{ vhost.root_dir|default(none) }} internal_access: {{ vhost.internal_access|default(false) }} dirs: {{ vhost.dirs|default([]) }} php_socket_file: {{ nginx.config.php_socket_file }} diff --git a/states/nginx/map.jinja b/states/nginx/map.jinja index d5a9bb4..85bd16d 100644 --- a/states/nginx/map.jinja +++ b/states/nginx/map.jinja @@ -2,4 +2,4 @@ {%- set nginx = salt['pillar.get']('nginx', default=defaults.nginx, merge=True) %} -{%- set net = salt['pillar.get']('net', merge=True) %} \ No newline at end of file +{%- set net = salt['pillar.get']('net') %} \ No newline at end of file diff --git a/states/nginx/templates/access.j2 b/states/nginx/templates/access.j2 index c5d5aac..99fafea 100644 --- a/states/nginx/templates/access.j2 +++ b/states/nginx/templates/access.j2 @@ -1,8 +1,9 @@ ## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }} -{%- for key, value in salt['pillar.get']('net:ipv4_networks').items() %} +{%- from "nginx/map.jinja" import net with context %} +{%- for key, value in net.ipv4_networks.items() %} allow {{ value.ip }}/{{ value.mask }}; {%- endfor %} -{%- for key, value in salt['pillar.get']('net:ipv6_networks').items() %} +{%- for key, value in net.ipv6_networks.items() %} allow {{ value.ip }}/{{ value.mask }}; {%- endfor %} deny all; \ No newline at end of file