Skip to content

Commit a926a34

Browse files
sjuggeJurgen Verhasselt
andauthored
Add 'nginx_app_protect_manage_repo' feature flag and defaults (#108)
Co-authored-by: Jurgen Verhasselt <[email protected]>
1 parent 4a331eb commit a926a34

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 0.5.1 (Unreleased)
44

5+
FEATURES:
6+
7+
Add a `nginx_app_protect_manage_repo` feature flag which can be used to disable NGINX App Protect repo management by this role.
8+
59
ENHANCEMENTS:
610

711
* Replace Ansible base with Ansible core. Ansible core will be the "core" Ansible release moving forward from Ansible `2.11`.

defaults/main.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ nginx_app_protect_install_threat_campaigns: true
3535
# nginx_plus: https://cs.nginx.com/static/keys/nginx_signing.key
3636
# security_updates: https://cs.nginx.com/static/keys/app-protect-security-updates.key
3737

38+
# Specify whether or not you want to manage the NGINX App Protect repositories.
39+
# Using 'true' will manage NGINX App Protect repositories.
40+
# Using 'false' will not manage the NGINX App Protect repositories, allowing them to be managed through other means.
41+
# Default is true
42+
nginx_app_protect_manage_repo: true
43+
3844
# (Optional) Specify repository for NGINX Plus.
3945
# Defaults are the official NGINX repositories.
4046
# nginx_plus_repository: deb [arch=amd64] https://pkgs.nginx.com/plus/debian buster nginx-plus

tasks/install/install-alpine.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,25 @@
55
insertafter: EOF
66
line: "{{ nginx_plus_repository | default(nginx_plus_default_repository_alpine) }}"
77
state: "{{ nginx_license_status | default ('present') }}"
8+
when: nginx_app_protect_manage_repo | bool
89

910
- name: (Alpine Linux) {{ nginx_license_status is defined | ternary('Remove', 'Configure') }} NGINX App Protect repository
1011
lineinfile:
1112
path: /etc/apk/repositories
1213
insertafter: EOF
1314
line: "{{ nginx_app_protect_repository | default(nginx_app_protect_default_repository_alpine) }}"
1415
state: "{{ nginx_license_status | default ('present') }}"
16+
when: nginx_app_protect_manage_repo | bool
1517

1618
- name: (Alpine Linux) {{ nginx_license_status is defined | ternary('Remove', 'Configure') }} NGINX App Protect security updates repository
1719
lineinfile:
1820
path: /etc/apk/repositories
1921
insertafter: EOF
2022
line: "{{ nginx_app_protect_security_updates_repository | default(nginx_app_protect_security_updates_default_repository_alpine) }}"
2123
state: "{{ nginx_license_status | default ('present') }}"
22-
when: nginx_app_protect_install_signatures | bool
23-
or nginx_app_protect_install_threat_campaigns | bool
24+
when:
25+
- (nginx_app_protect_install_signatures | bool) or (nginx_app_protect_install_threat_campaigns | bool)
26+
- nginx_app_protect_manage_repo | bool
2427

2528
- name: (Alpine Linux) Install NGINX App Protect
2629
apk:

tasks/install/install-debian.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
mode: 0644
4646
update_cache: false
4747
state: "{{ nginx_app_protect_license_status | default ('present') }}"
48+
when: nginx_app_protect_manage_repo | bool
4849

4950
- name: (Debian/Ubuntu) {{ nginx_app_protect_license_status is defined | ternary('Remove', 'Configure') }} NGINX App Protect repository
5051
apt_repository:
@@ -53,6 +54,7 @@
5354
mode: 0644
5455
update_cache: false
5556
state: "{{ nginx_app_protect_license_status | default ('present') }}"
57+
when: nginx_app_protect_manage_repo | bool
5658

5759
- name: (Debian/Ubuntu) {{ nginx_app_protect_license_status is defined | ternary('Remove', 'Configure') }} NGINX App Protect security updates repository
5860
apt_repository:
@@ -61,8 +63,9 @@
6163
mode: 0644
6264
update_cache: false
6365
state: "{{ nginx_app_protect_license_status | default ('present') }}"
64-
when: nginx_app_protect_install_signatures | bool
65-
or nginx_app_protect_install_threat_campaigns | bool
66+
when:
67+
- (nginx_app_protect_install_signatures | bool) or (nginx_app_protect_install_threat_campaigns | bool)
68+
- nginx_app_protect_manage_repo | bool
6669

6770
- name: (Debian/Ubuntu) Install NGINX App Protect
6871
apt:

tasks/install/install-redhat.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
enabled: true
2121
gpgcheck: true
2222
state: "{{ nginx_app_protect_license_status | default ('present') }}"
23+
when: nginx_app_protect_manage_repo | bool
2324

2425
- name: (CentOS/RHEL) {{ nginx_app_protect_license_status is defined | ternary('Remove', 'Configure') }} NGINX App Protect security updates repository
2526
yum_repository:
@@ -31,8 +32,9 @@
3132
enabled: true
3233
gpgcheck: true
3334
state: "{{ nginx_app_protect_license_status | default ('present') }}"
34-
when: nginx_app_protect_install_signatures | bool
35-
or nginx_app_protect_install_threat_campaigns | bool
35+
when:
36+
- (nginx_app_protect_install_signatures | bool) or (nginx_app_protect_install_threat_campaigns | bool)
37+
- nginx_app_protect_manage_repo | bool
3638

3739
- name: (CentOS/RHEL) Install NGINX App Protect
3840
yum:

0 commit comments

Comments
 (0)