Browse Source

Define nginx's global options and package name.

Marcin Wolny 9 years ago
parent
commit
790badecb3
3 changed files with 15 additions and 1 deletions
  1. 10 0
      defaults/main.yml
  2. 1 1
      tasks/setup-Debian.yml
  3. 4 0
      templates/nginx.conf.j2

+ 10 - 0
defaults/main.yml

@@ -2,6 +2,10 @@
 # Used only for Debian/Ubuntu installation, as the -t option for apt.
 nginx_default_release: ""
 
+# Distros like Debian/Ubuntu ships nginx package with different flavors, e.g.
+# full, light or extras.
+nginx_package_name: "nginx"
+
 nginx_worker_processes: "1"
 nginx_worker_connections: "1024"
 
@@ -19,6 +23,12 @@ nginx_client_max_body_size: "64m"
 
 nginx_proxy_cache_path: ""
 
+nginx_extra_conf_options: ""
+# Example extra main options, used within the main nginx's context:
+#   nginx_extra_conf_options: |
+#     env VARIABLE;
+#     include /etc/nginx/main.d/*.conf;
+
 nginx_extra_http_options: ""
 # Example extra http options, printed inside the main server http config:
 #    nginx_extra_http_options: |

+ 1 - 1
tasks/setup-Debian.yml

@@ -4,6 +4,6 @@
 
 - name: Ensure nginx is installed.
   apt:
-    pkg: nginx
+    pkg: "{{ nginx_package_name }}"
     state: installed
     default_release: "{{ nginx_default_release }}"

+ 4 - 0
templates/nginx.conf.j2

@@ -9,6 +9,10 @@ events {
     worker_connections  {{ nginx_worker_connections }};
 }
 
+{% if nginx_extra_conf_options %}
+{{ nginx_extra_conf_options }}
+{% endif %}
+
 http {
     include       /etc/nginx/mime.types;
     default_type  application/octet-stream;