Skip to content

feat: Template support for the NGINX HTTP gzip static module #560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions defaults/main/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions molecule/complete/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@
min_length: 20
proxied:
- expired
static: always
types:
- text/html
vary: false
Expand Down
1 change: 1 addition & 0 deletions molecule/complete_plus/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
min_length: 20
proxied:
- expired
static: false
vary: false
auth_jwt:
enable: false
Expand Down
3 changes: 3 additions & 0 deletions templates/http/modules.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
2 changes: 1 addition & 1 deletion templates/stream/modules.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
Loading