Add static core modules support to installation from source (#448)

This commit is contained in:
Sina Tak Tehrani 2021-10-07 12:05:04 +00:00 committed by GitHub
parent 028c1d1fe3
commit 62db1bb0cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View File

@ -92,11 +92,18 @@ nginx_setup_license: true
# Default is true. # Default is true.
nginx_remove_license: true nginx_remove_license: true
# Install NGINX Modules. # Install NGINX Static Modules.
# You can select any of the modules listed below. Beware of NGINX Plus only modules (these are marked). # You can select any of the static modules listed on http://nginx.org/en/docs/configure.html.
# Format is list with either the module name or a dictionary (see njs for an example). # 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. # 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: [] nginx_modules: []
# - auth-spnego # NGINX Plus # - auth-spnego # NGINX Plus
# - brotli # NGINX Plus # - brotli # NGINX Plus

View File

@ -10,6 +10,7 @@
nginx_install_from: source nginx_install_from: source
nginx_branch: stable nginx_branch: stable
nginx_static_modules: ['http_ssl_module']
nginx_install_source_build_tools: true nginx_install_source_build_tools: true
nginx_install_source_pcre: true nginx_install_source_pcre: true
nginx_install_source_openssl: true nginx_install_source_openssl: true

View File

@ -42,7 +42,7 @@
when: nginx_type == "plus" when: nginx_type == "plus"
tags: nginx_install_plus tags: nginx_install_plus
- name: Install NGINX modules - name: Install NGINX dynamic modules
include_tasks: "{{ role_path }}/tasks/modules/install-modules.yml" include_tasks: "{{ role_path }}/tasks/modules/install-modules.yml"
when: when:
- nginx_modules is defined - nginx_modules is defined

View File

@ -312,6 +312,11 @@
src: "{{ nginx_source.dest }}" src: "{{ nginx_source.dest }}"
mode: 0755 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 - name: Configure NGINX
command: >- command: >-
./configure ./configure
@ -322,12 +327,12 @@
--modules-path=/usr/lib/nginx/modules --modules-path=/usr/lib/nginx/modules
--prefix=/usr --prefix=/usr
--pid-path=/var/run/nginx.pid --pid-path=/var/run/nginx.pid
--with-http_ssl_module
--with-mail=dynamic --with-mail=dynamic
--with-stream --with-stream
{{ nginx_install_source_pcre | ternary('', '--with-pcre=../' + pcre_version) }} {{ nginx_install_source_pcre | ternary('', '--with-pcre=../' + pcre_version) }}
{{ nginx_install_source_zlib | ternary('', '--with-zlib=../' + zlib_version) }} {{ nginx_install_source_zlib | ternary('', '--with-zlib=../' + zlib_version) }}
{{ nginx_install_source_openssl | ternary('', '--with-openssl=../' + openssl_version) }} {{ nginx_install_source_openssl | ternary('', '--with-openssl=../' + openssl_version) }}
{{ nginx_install_source_static_modules | default('') }}
args: args:
chdir: "/tmp/{{ nginx_version }}" chdir: "/tmp/{{ nginx_version }}"
register: nginx_configure register: nginx_configure

View File

@ -72,12 +72,12 @@ pcre_version: pcre-8.44
zlib_version: zlib-1.2.11 zlib_version: zlib-1.2.11
openssl_version: openssl-1.1.1g openssl_version: openssl-1.1.1g
# Supported NGINX Open Source modules # Supported NGINX Open Source dynamic modules
nginx_modules_list: [ nginx_modules_list: [
'geoip', 'image-filter', 'njs', 'perl', 'xslt', 'geoip', 'image-filter', 'njs', 'perl', 'xslt',
] ]
# Supported NGINX Plus modules # Supported NGINX Plus dynamic modules
nginx_plus_modules_list: [ nginx_plus_modules_list: [
'auth-spnego', 'brotli', 'cookie-flag', 'encrypted-session', 'geoip', 'geoip2', 'headers-more', 'image-filter', 'auth-spnego', 'brotli', 'cookie-flag', 'encrypted-session', 'geoip', 'geoip2', 'headers-more', 'image-filter',
'lua', 'njs', 'opentracing', 'passenger', 'perl', 'prometheus', 'rtmp', 'subs-filter', 'xslt', 'lua', 'njs', 'opentracing', 'passenger', 'perl', 'prometheus', 'rtmp', 'subs-filter', 'xslt',