From a89bf0f57254d91fe65242773f77cbe87a7da534 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Mon, 7 Dec 2015 13:19:09 -0500 Subject: [PATCH] Override default nginx.conf file Signed-off-by: Paul Belanger --- defaults/main.yaml | 3 +++ files/etc/nginx/nginx.conf | 30 ++++++++++++++++++++++++++++++ tasks/config.yaml | 6 ++++++ 3 files changed, 39 insertions(+) create mode 100644 files/etc/nginx/nginx.conf diff --git a/defaults/main.yaml b/defaults/main.yaml index e66d1e4..f9d1679 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -13,3 +13,6 @@ # under the License. --- nginx_config_include_files: [] + +nginx_file_nginx_conf: etc/nginx/nginx.conf +nginx_file_nginx_conf_dest: /etc/nginx/nginx.conf diff --git a/files/etc/nginx/nginx.conf b/files/etc/nginx/nginx.conf new file mode 100644 index 0000000..6a94b90 --- /dev/null +++ b/files/etc/nginx/nginx.conf @@ -0,0 +1,30 @@ +user nginx; +worker_processes auto; +error_log /var/log/nginx/error.log; +pid /run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + # Load modular configuration files from the /etc/nginx/conf.d directory. + # See http://nginx.org/en/docs/ngx_core_module.html#include + # for more information. + include /etc/nginx/conf.d/*.conf; +} diff --git a/tasks/config.yaml b/tasks/config.yaml index 5ae9016..7a485e5 100644 --- a/tasks/config.yaml +++ b/tasks/config.yaml @@ -20,3 +20,9 @@ notify: - Restart nginx - Validate nginx + +- name: Copy nginx configuration file. + copy: + dest: "{{ nginx_file_nginx_conf_dest }}" + src: "{{ nginx_file_nginx_conf }}" + notify: Restart nginx