From bc80e9fd5d176c3b6ffa242d5d661e3eb1d02ec5 Mon Sep 17 00:00:00 2001 From: Ryan MacDonald Date: Wed, 26 Sep 2018 14:33:49 -0500 Subject: [PATCH 1/3] support events{} extra options support events{} extra options --- templates/nginx.conf.j2 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index b13be94..a619ec1 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -15,6 +15,10 @@ worker_processes {{ nginx_worker_processes }}; events { worker_connections {{ nginx_worker_connections }}; multi_accept {{ nginx_multi_accept | default('off') }}; +{% if nginx_extra_events_options %} + {{ nginx_extra_events_options|indent(4, False) }} +{% endif %} + {% if nginx_use_method is defined %} use {{ nginx_use_method }}; {% endif %} From 90f9bf4bcdb3bd7d23bb6959079a7c7f8744c9dc Mon Sep 17 00:00:00 2001 From: Ryan MacDonald Date: Wed, 26 Sep 2018 14:47:06 -0500 Subject: [PATCH 2/3] add defaults for nginx_extra_events_options - add defaults for nginx_extra_events_options - get rid of explicit use method, drop into options --- defaults/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 1e6944f..f711e71 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -18,7 +18,12 @@ nginx_vhost_template: "vhost.j2" nginx_worker_processes: "{{ ansible_processor_vcpus | default(ansible_processor_count) }}" nginx_worker_connections: "1024" nginx_multi_accept: "off" -#nginx_use_method: "epoll" + +nginx_extra_events_options: "" +# Example extra events{} options +# nginx_extra_events_options: | +# accept_mutex on; +# use epoll; nginx_error_log: "/var/log/nginx/error.log warn" nginx_access_log: "/var/log/nginx/access.log main buffer=16k flush=2m" From 8336bde4a2cfa7b25fc7a47556d79f6a83fdaef9 Mon Sep 17 00:00:00 2001 From: Ryan MacDonald Date: Wed, 26 Sep 2018 14:48:26 -0500 Subject: [PATCH 3/3] remove nginx_use_method - remove nginx_use_method, define if needed as part of nginx_extra_events_options --- templates/nginx.conf.j2 | 3 --- 1 file changed, 3 deletions(-) diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index a619ec1..548082e 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -19,9 +19,6 @@ events { {{ nginx_extra_events_options|indent(4, False) }} {% endif %} -{% if nginx_use_method is defined %} - use {{ nginx_use_method }}; -{% endif %} } {% endblock %}