aboutsummaryrefslogtreecommitdiff
path: root/roles/nginx/templates/nginx.conf.j2
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2023-09-01 01:27:09 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2023-09-01 01:27:09 +0200
commit347803f5a811972c719b09999d4d2b5e9e32e3eb (patch)
treecd7c5705426ae0ff8a41e84418c5407fbc1ec810 /roles/nginx/templates/nginx.conf.j2
parent7ad67630c40c0669cc1c140ff2d42311fb780b47 (diff)
downloadansible_collection-347803f5a811972c719b09999d4d2b5e9e32e3eb.tar.gz
new nginx role
Diffstat (limited to 'roles/nginx/templates/nginx.conf.j2')
-rw-r--r--roles/nginx/templates/nginx.conf.j218
1 files changed, 18 insertions, 0 deletions
diff --git a/roles/nginx/templates/nginx.conf.j2 b/roles/nginx/templates/nginx.conf.j2
new file mode 100644
index 0000000..875003b
--- /dev/null
+++ b/roles/nginx/templates/nginx.conf.j2
@@ -0,0 +1,18 @@
+# vi: ft=nginx
+# This file is managed by Ansible. DO NOT CHANGE!
+
+{%- macro add_tabs(n) %}{% for i in range(n) %} {%endfor%}{% endmacro %}
+{% macro procval(key, val, tabs) -%}
+{% if val is mapping %}{{ add_tabs(tabs) }}{{ key }} {
+{% for k, v in val.items() %}{{ procval(k,v,tabs+1) }}
+{{ add_tabs(tabs) }}{% endfor -%} }
+{%- else -%}
+{{ add_tabs(tabs) }}{{ key }} {{ val }};
+{%- endif -%}
+{% endmacro %}
+
+server {
+{% for key in item.value -%}
+{{ procval(key, item.value[key], 1) }}
+{% endfor -%}
+}