From 8ead2b7c009befb731abf21a65b288ac9eb30987 Mon Sep 17 00:00:00 2001 From: Alessandro Fael Garcia Date: Mon, 21 Jan 2019 17:20:16 +0100 Subject: [PATCH] Install RTMP only when using NGINX Plus (#91) * Install RTMP only when using NGINX Plus * Make GeoIP and NJS module tasks idempotent --- tasks/modules/install-geoip.yml | 9 +++++---- tasks/modules/install-modules.yml | 2 +- tasks/modules/install-njs.yml | 9 +++++---- tasks/modules/install-rtmp.yml | 7 ------- 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/tasks/modules/install-geoip.yml b/tasks/modules/install-geoip.yml index f03c6d6..89b9ca7 100644 --- a/tasks/modules/install-geoip.yml +++ b/tasks/modules/install-geoip.yml @@ -12,10 +12,11 @@ when: nginx_type == "plus" - name: "(Setup: All NGINX) Load NGINX GeoIP Module" - blockinfile: + lineinfile: path: /etc/nginx/nginx.conf insertbefore: BOF - block: | - load_module modules/ngx_http_geoip_module.so; - load_module modules/ngx_stream_geoip_module.so; + line: "{{ item }}" + with_items: + - load_module modules/ngx_http_geoip_module.so; + - load_module modules/ngx_stream_geoip_module.so; notify: "(Handler: All OSs) Reload NGINX" diff --git a/tasks/modules/install-modules.yml b/tasks/modules/install-modules.yml index b55dc82..7179d6d 100644 --- a/tasks/modules/install-modules.yml +++ b/tasks/modules/install-modules.yml @@ -12,7 +12,7 @@ when: nginx_modules.image_filter | default(false) - import_tasks: install-rtmp.yml - when: nginx_modules.rtmp | default(false) + when: nginx_modules.rtmp | default(false) and nginx_type == "plus" - import_tasks: install-xslt.yml when: nginx_modules.xslt | default(false) diff --git a/tasks/modules/install-njs.yml b/tasks/modules/install-njs.yml index d8b9eea..15c951a 100644 --- a/tasks/modules/install-njs.yml +++ b/tasks/modules/install-njs.yml @@ -12,10 +12,11 @@ when: nginx_type == "plus" - name: "(Setup: All NGINX) Load NGINX JavaScript Module" - blockinfile: + lineinfile: path: /etc/nginx/nginx.conf insertbefore: BOF - block: | - load_module modules/ngx_http_js_module.so; - load_module modules/ngx_stream_js_module.so; + line: "{{ item }}" + with_items: + - load_module modules/ngx_http_js_module.so; + - load_module modules/ngx_stream_js_module.so; notify: "(Handler: All OSs) Reload NGINX" diff --git a/tasks/modules/install-rtmp.yml b/tasks/modules/install-rtmp.yml index 6cd8a1d..a50d987 100644 --- a/tasks/modules/install-rtmp.yml +++ b/tasks/modules/install-rtmp.yml @@ -1,15 +1,8 @@ --- -- name: "(Install: All OSs) Install NGINX Open Source RTMP Module" - package: - name: nginx-module-rtmp - state: present - when: nginx_type == "opensource" - - name: "(Install: All OSs) Install NGINX Plus RTMP Module" package: name: nginx-plus-module-rtmp state: present - when: nginx_type == "plus" - name: "(Setup: All NGINX) Load NGINX RTMP Module" lineinfile: