From 443023071f9356204197712849787d9c1fefda08 Mon Sep 17 00:00:00 2001 From: Sergey Fayngold Date: Mon, 18 May 2015 00:20:20 +0200 Subject: [PATCH] Make the pid directive configurable --- defaults/main.yml | 2 ++ templates/nginx.conf.j2 | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 49f68a6..a378927 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -21,6 +21,8 @@ nginx_conf_dir: "/etc/nginx" nginx_user: "{% if ansible_os_family == 'RedHat' %}nginx{% elif ansible_os_family == 'Debian' %}www-data{% endif %}" nginx_group: "{{nginx_user}}" +nginx_pid_file: '/var/run/{{nginx_service_name}}.pid' + nginx_worker_processes: "{{ ansible_processor_vcpus }}" nginx_max_clients: 512 nginx_worker_rlimit_nofile: 1024 diff --git a/templates/nginx.conf.j2 b/templates/nginx.conf.j2 index ffad3c4..687b2d6 100644 --- a/templates/nginx.conf.j2 +++ b/templates/nginx.conf.j2 @@ -2,7 +2,11 @@ user {{ nginx_user }}; worker_processes {{ nginx_worker_processes }}; -pid /var/run/nginx.pid; + +{% if nginx_pid_file %} +pid {{ nginx_pid_file }}; +{% endif %} + worker_rlimit_nofile {{ nginx_worker_rlimit_nofile }}; events {