Skip to content

Commit 5f3952e

Browse files
authored
Support the latest NGINX Plus R26 directives (#261)
1 parent 915be56 commit 5f3952e

File tree

7 files changed

+27
-13
lines changed

7 files changed

+27
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
ENHANCEMENTS:
66

7-
Bump the Ansible `community.general` collection to `5.1.1`, `ansible.posix` collection to `1.4.0` and `community.docker` collection to `2.6.0`.
7+
* Bump the Ansible `community.general` collection to `5.1.1`, `ansible.posix` collection to `1.4.0` and `community.docker` collection to `2.6.0`.
8+
* Add support for the latest NGINX Plus R26 directives:
9+
* `auth_jwt_require` now allows you to optionally set the `error` code you wish to return.
10+
* `health_check` now lets you set a `keepalive_time`.
811

912
BUG FIXES:
1013

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,43 +68,43 @@ The NGINX config Ansible role supports all platforms supported by [NGINX Open So
6868

6969
```yaml
7070
Alpine:
71-
- 3.11
72-
- 3.12
7371
- 3.13
7472
- 3.14
73+
- 3.15
74+
- 3.16
7575
Amazon Linux:
7676
- 2
7777
CentOS:
7878
- 7.4+
79-
- 8
8079
Debian:
8180
- buster (10)
8281
- bullseye (11)
8382
Red Hat:
8483
- 7.4+
8584
- 8
85+
- 9
8686
SUSE/SLES:
8787
- 12
8888
- 15
8989
Ubuntu:
9090
- bionic (18.04)
9191
- focal (20.04)
92-
- hirsute (21.04)
92+
- impish (21.10)
93+
- jammy (22.04)
9394
```
9495

9596
### NGINX Plus
9697

9798
```yaml
9899
Alpine:
99-
- 3.11
100-
- 3.12
101100
- 3.13
102101
- 3.14
102+
- 3.15
103+
- 3.16
103104
Amazon Linux 2:
104105
- any
105106
CentOS:
106107
- 7.4+
107-
- 8
108108
Debian:
109109
- buster (10)
110110
- bullseye (11)
@@ -116,12 +116,14 @@ Oracle Linux:
116116
Red Hat:
117117
- 7.4+
118118
- 8
119+
- 9
119120
SUSE/SLES:
120121
- 12
121122
- 15
122123
Ubuntu:
123124
- bionic (18.04)
124125
- focal (20.04)
126+
- jammy (22.04)
125127
```
126128

127129
## Role Variables

defaults/main/template.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,9 @@ nginx_config_http_template:
529529
key_request: /path/to/file
530530
leeway: 0s
531531
type: signed # Can be set to 'signed', 'encrypted' or 'nested'
532-
require: $valid_jwt_iss # String or a list of strings
532+
require:
533+
values: $valid_jwt_iss # Required -- String or a list of strings
534+
error: 401 # Can be set to '401' or '403'
533535
api: # Available only in NGINX Plus -- Configure HTTP API
534536
enable: # true # Set to Boolean directly to simply enable the 'api' directive -- Available only in the 'location' context
535537
write: true # Boolean
@@ -582,6 +584,7 @@ nginx_config_http_template:
582584
port: 80
583585
grpc_service: service
584586
grpc_status: 12
587+
keepalive_time: 0
585588
match: # Available only in the 'http' context
586589
- name: name # Required
587590
conditions: []

meta/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ galaxy_info:
2424
versions:
2525
- '7'
2626
- '8'
27+
- '9'
2728
- name: FreeBSD
2829
versions:
2930
- '12.1'
3031
- name: Ubuntu
3132
versions:
3233
- bionic
3334
- focal
34-
- hirsute
35+
- impish
36+
- jammy
3537
- name: SLES
3638
versions:
3739
- '12'

molecule/plus/converge.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@
213213
name: info
214214
leeway: 0s
215215
type: nested
216-
require: jwt
216+
require:
217+
values: $jwt_claim_iss
218+
error: 403
217219
auth_request:
218220
uri: false
219221
set:
@@ -416,6 +418,7 @@
416418
persistent: false
417419
match: nginx
418420
port: 80
421+
keepalive_time: 0
419422
proxy:
420423
bind: false
421424
buffer_size: 4k

templates/http/auth.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ auth_jwt_leeway {{ auth_jwt['leeway'] }};
7474
auth_jwt_type {{ auth_jwt['type'] }};
7575
{% endif %}
7676
{% if auth_jwt['require'] is defined %}
77-
auth_jwt_require {{ auth_jwt['require'] if auth_jwt['require'] is string else auth_jwt['require'] | join(' ') }};
77+
auth_jwt_require {{ auth_jwt['require']['values'] if auth_jwt['require']['values'] is string else auth_jwt['require']['values'] | join(' ') }}{{ (' ' + auth_jwt['require']['error'] | string) if auth_jwt['require']['error'] in ['401', '403'] }};
7878
{% endif %}
7979

8080
{% endmacro %}

templates/http/modules.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ health_check{{ (' interval=' + health_check['interval'] | string) if health_chec
118118
{{- (' port=' + health_check['port'] | string) if health_check['port'] is defined -}}
119119
{{- ' type=grpc' if health_check['grpc_service'] is defined or health_check['grpc_status'] is defined -}}
120120
{{- (' grpc_service=' + health_check['grpc_service'] | string) if health_check['grpc_service'] is defined -}}
121-
{{- (' grpc_status=' + health_check['grpc_status'] | string) if health_check['grpc_status'] is defined }};
121+
{{- (' grpc_status=' + health_check['grpc_status'] | string) if health_check['grpc_status'] is defined -}}
122+
{{- (' keepalive_time=' + health_check['keepalive_time'] | string) if health_check['keepalive_time'] is defined }};
122123
{% endfor %}
123124
{% endif %}
124125
{% if health_check['match'] is defined and health_check['match'] is not string and health_check['match'] is not mapping %}{# 'match' directive is only available in the 'http' context #}

0 commit comments

Comments
 (0)