diff --git a/defaults/main.yml b/defaults/main.yml index 27f1853..f5a4c7d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -47,3 +47,4 @@ nginx_yum_pkg: nginx nginx_yum_enablerepo: nginx nginx_yum_disablerepo: no nginx_apt_use_ppa_repo: yes # Use of nginx PPA repo +nginx_enable_dynamic_modules: no # Enable dynamic modules like geo diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index 88dd27b..37cbb10 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -1,6 +1,10 @@ # This file was generated by Ansible for {{ ansible_fqdn }} # Do NOT modify this file by hand! +{% if nginx_enable_dynamic_modules %} +include {{ nginx_dir }}/modules-enabled/*; +{% endif %} + user {{nginx_user}}; worker_processes {{nginx_worker_processes}}; @@ -9,6 +13,11 @@ events { worker_connections {{nginx_worker_connections}}; } +{% if nginx_streams_dir %} +stream { + include {{nginx_streams_dir}}/*; +} +{% endif %} http { include mime.types; @@ -37,13 +46,13 @@ http { server_names_hash_bucket_size {{nginx_server_names_hash_bucket_size}}; - access_log {{nginx_access_log}}; - error_log {{nginx_error_log}}; - {% if nginx_http_options %}{% for option in nginx_http_options %} {{option}} {% endfor %}{% endif %} + access_log {{nginx_access_log}}; + error_log {{nginx_error_log}}; + {% if nginx_status %} server { listen {{ nginx_status }}; @@ -58,13 +67,10 @@ http { {% if nginx_servers %}{% for server_config in nginx_servers %} server { - - {{ server_config.split('\n')|join('\t\n') }} - + {{ server_config.split('\n')|join('\t\n') }} } {% endfor %}{% endif %} include {{nginx_dir}}/conf.d/*.conf; include {{nginx_sites_dir}}/*; - }