From 21e03b27dd50909fcbce93c51ea591ba6bafd604 Mon Sep 17 00:00:00 2001 From: Emile Broeders Date: Wed, 24 Jun 2020 15:50:28 +0200 Subject: [PATCH] Adding nginx_main_template.http_custom_includes (#270) --- defaults/main/template.yml | 1 + molecule/common/playbook_template.yml | 2 ++ templates/nginx.conf.j2 | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/defaults/main/template.yml b/defaults/main/template.yml index 868d6e2..8d75b67 100644 --- a/defaults/main/template.yml +++ b/defaults/main/template.yml @@ -49,6 +49,7 @@ nginx_main_template: types: "text/html" # custom_options: [] # http_custom_options: [] + # http_custom_includes: [] # events_custom_options: [] stream_enable: false # stream_custom_options: [] diff --git a/molecule/common/playbook_template.yml b/molecule/common/playbook_template.yml index 5c5000b..2dc667c 100644 --- a/molecule/common/playbook_template.yml +++ b/molecule/common/playbook_template.yml @@ -44,6 +44,8 @@ - master_process on; http_custom_options: - aio off; + http_custom_includes: + - "/etc/nginx/sites-enabled/*.conf" events_custom_options: - accept_mutex off; stream_enable: true diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index 3a14d34..e2b2536 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -119,6 +119,11 @@ http { {% endfor %} {% endif %} include /etc/nginx/conf.d/*.conf; +{% if nginx_main_template.http_custom_includes is defined and nginx_main_template.http_custom_includes | length %} +{% for inline_include in nginx_main_template.http_custom_includes %} + include {{ inline_include }}; +{% endfor %} +{% endif %} } {% endif %}