From 62db1bb0cccda7ae6b5457faa79e7cd311ad56c2 Mon Sep 17 00:00:00 2001 From: Sina Tak Tehrani Date: Thu, 7 Oct 2021 12:05:04 +0000 Subject: [PATCH] Add static core modules support to installation from source (#448) --- defaults/main/main.yml | 15 +++++++++++---- molecule/source/converge.yml | 1 + tasks/main.yml | 2 +- tasks/opensource/install-source.yml | 7 ++++++- vars/main.yml | 4 ++-- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/defaults/main/main.yml b/defaults/main/main.yml index 20959d7..e358388 100644 --- a/defaults/main/main.yml +++ b/defaults/main/main.yml @@ -92,11 +92,18 @@ nginx_setup_license: true # Default is true. nginx_remove_license: true -# Install NGINX Modules. -# You can select any of the modules listed below. Beware of NGINX Plus only modules (these are marked). -# Format is list with either the module name or a dictionary (see njs for an example). +# Install NGINX Static Modules. +# You can select any of the static modules listed on http://nginx.org/en/docs/configure.html. +# Format is '--with-*' where '*' should be used as static module name in the list below. (see an example below). +# Default is 'http_ssl_module'. (DO NOT remove it if you need SSL support). +nginx_static_modules: ['http_ssl_module'] +# nginx_static_modules: ['http_v2_module'] # Example for '--with-http_v2_module' + +# Install NGINX Dynamic Modules. +# You can select any of the dynamic modules listed below. Beware of NGINX Plus only dynamic modules (these are marked). +# Format is list with either the dynamic module name or a dictionary (see njs for an example). # When using a dictionary, the default value for state is present, and for version it's nginx_version if specified. -# Default is an empty list (no modules are installed). +# Default is an empty list (no dynamic modules are installed). nginx_modules: [] # - auth-spnego # NGINX Plus # - brotli # NGINX Plus diff --git a/molecule/source/converge.yml b/molecule/source/converge.yml index 534fc85..327b2d8 100644 --- a/molecule/source/converge.yml +++ b/molecule/source/converge.yml @@ -10,6 +10,7 @@ nginx_install_from: source nginx_branch: stable + nginx_static_modules: ['http_ssl_module'] nginx_install_source_build_tools: true nginx_install_source_pcre: true nginx_install_source_openssl: true diff --git a/tasks/main.yml b/tasks/main.yml index 25bf6cf..573d43a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -42,7 +42,7 @@ when: nginx_type == "plus" tags: nginx_install_plus - - name: Install NGINX modules + - name: Install NGINX dynamic modules include_tasks: "{{ role_path }}/tasks/modules/install-modules.yml" when: - nginx_modules is defined diff --git a/tasks/opensource/install-source.yml b/tasks/opensource/install-source.yml index 931bc49..f8aae2f 100644 --- a/tasks/opensource/install-source.yml +++ b/tasks/opensource/install-source.yml @@ -312,6 +312,11 @@ src: "{{ nginx_source.dest }}" mode: 0755 + - name: Set static modules + set_fact: + nginx_install_source_static_modules: "{{ nginx_install_source_static_modules | default('') + ' --with-' + item }}" + loop: "{{ nginx_static_modules }}" + - name: Configure NGINX command: >- ./configure @@ -322,12 +327,12 @@ --modules-path=/usr/lib/nginx/modules --prefix=/usr --pid-path=/var/run/nginx.pid - --with-http_ssl_module --with-mail=dynamic --with-stream {{ nginx_install_source_pcre | ternary('', '--with-pcre=../' + pcre_version) }} {{ nginx_install_source_zlib | ternary('', '--with-zlib=../' + zlib_version) }} {{ nginx_install_source_openssl | ternary('', '--with-openssl=../' + openssl_version) }} + {{ nginx_install_source_static_modules | default('') }} args: chdir: "/tmp/{{ nginx_version }}" register: nginx_configure diff --git a/vars/main.yml b/vars/main.yml index 0821ccd..856f1e4 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -72,12 +72,12 @@ pcre_version: pcre-8.44 zlib_version: zlib-1.2.11 openssl_version: openssl-1.1.1g -# Supported NGINX Open Source modules +# Supported NGINX Open Source dynamic modules nginx_modules_list: [ 'geoip', 'image-filter', 'njs', 'perl', 'xslt', ] -# Supported NGINX Plus modules +# Supported NGINX Plus dynamic modules nginx_plus_modules_list: [ 'auth-spnego', 'brotli', 'cookie-flag', 'encrypted-session', 'geoip', 'geoip2', 'headers-more', 'image-filter', 'lua', 'njs', 'opentracing', 'passenger', 'perl', 'prometheus', 'rtmp', 'subs-filter', 'xslt',