diff --git a/CHANGELOG.md b/CHANGELOG.md index 250f9387..c1a96971 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ FEATURES: - Add validation tasks to check the Ansible version, the Jinja2 version, and whether the required Ansible collections for this role are installed. - Bump the Ansible `community.general` collection to `9.2.0`, `community.crypto` collection to `2.21.1` and `community.docker` collection to `3.11.0`. -- Add templating support for the `ngx_stream_map_module` NGINX module. +- Add templating support for the `ngx_http_gzip_static_module` and `ngx_stream_map_module` NGINX modules. BUG FIXES: diff --git a/defaults/main/template.yml b/defaults/main/template.yml index 84d46a1f..670ea93a 100644 --- a/defaults/main/template.yml +++ b/defaults/main/template.yml @@ -579,6 +579,7 @@ nginx_config_http_template: http_version: 1.1 # Can be set to '1.0' or '1.1' min_length: 20 proxied: [] # String or a list of strings -- Can alternatively be set to 'false' + static: false # Boolean or 'always' types: [] # String or a list of strings vary: false # Boolean headers: # Configure headers diff --git a/molecule/complete/converge.yml b/molecule/complete/converge.yml index 820f6585..b5e5177e 100644 --- a/molecule/complete/converge.yml +++ b/molecule/complete/converge.yml @@ -464,6 +464,7 @@ min_length: 20 proxied: - expired + static: always types: - text/html vary: false diff --git a/molecule/complete_plus/converge.yml b/molecule/complete_plus/converge.yml index 83226087..ff27c89d 100644 --- a/molecule/complete_plus/converge.yml +++ b/molecule/complete_plus/converge.yml @@ -212,6 +212,7 @@ min_length: 20 proxied: - expired + static: false vary: false auth_jwt: enable: false diff --git a/templates/http/modules.j2 b/templates/http/modules.j2 index 0e7952c3..1efc1e6d 100644 --- a/templates/http/modules.j2 +++ b/templates/http/modules.j2 @@ -71,6 +71,9 @@ gzip_min_length {{ gzip['min_length'] }}; {% if gzip['proxied'] is defined %} gzip_proxied {{ 'off' if not gzip['proxied'] else (gzip['proxied'] if gzip['proxied'] is string else gzip['proxied'] | join(' ')) }}; {% endif %} +{% if gzip['static'] is defined %}{# ngx_http_gzip_static_module #}{# This does not belong here but we are making an exception #} +gzip_static {{ (gzip['static'] | ternary('on', 'off')) if gzip['static'] is boolean else gzip['static'] if gzip['static'] == 'always' }}; +{% endif %} {% if gzip['types'] is defined %} gzip_types {{ gzip['types'] if gzip['types'] is string else gzip['types'] | join(' ') }}; {% endif %} diff --git a/templates/stream/modules.j2 b/templates/stream/modules.j2 index 5f60ee66..d83fe953 100644 --- a/templates/stream/modules.j2 +++ b/templates/stream/modules.j2 @@ -67,7 +67,7 @@ access_log {{ 'off' if not log else log['path'] if log['path'] is defined }}{{ ( {{- (' if=' + log['if']) if log['if'] is defined }}; {% endfor %} {% endif %} -{% if log['error'] is defined %}{# This does not belong here but we are making an exception #} +{% if log['error'] is defined %}{# ngx_core_module #}{# This does not belong here but we are making an exception #} {% for log in log['error'] if (log['error'] is not mapping and log['error'] is not string) %} error_log {{ log if log is string else log['file'] }}{{ (' ' + log['level'] | string) if log['level'] is defined }}; {% else %}