Skip to content

Commit c452c6a

Browse files
committed
tasks to comment out app protect conf lines
1 parent c7b0d68 commit c452c6a

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

tasks/configure-app-protect.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,26 @@
3131
src: "{{ nginx_conf_template.template_file }}"
3232
dest: "{{ nginx_conf_template.out_file_location }}{{ nginx_conf_template.out_file_name }}"
3333
backup: true
34-
when: nginx_conf_template_enable
34+
when:
35+
- nginx_conf_template_enable
36+
- app_protect_state != "absent"
37+
38+
- name: "Remove NGINX App Protect"
39+
block:
40+
41+
- name: Comment out NGINX App Protect module reference in nginx.conf
42+
replace:
43+
path: /etc/nginx/nginx.conf
44+
regexp: '^([ \t]*load_module.*ngx_http_app_protect_module.so;)'
45+
replace: '# \1'
46+
47+
- name: Comment out NGINX App Protect directives in nginx.conf
48+
replace:
49+
path: /etc/nginx/nginx.conf
50+
regexp: '^([ \t]*app_protect_)'
51+
replace: '# \1'
52+
53+
when: app_protect_state == "absent"
3554

3655
- name: "Reload NGINX"
3756
debug:

tasks/install-app-protect.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@
1616

1717
- name: "(Install: Linux) Install NGINX Plus"
1818
import_tasks: install-app-protect-linux.yml
19-
# should not be needed, as a check is occurring for this in a higher level playbook is occuring
20-
# when: ansible_os_family in nginx_plus_linux_families

tasks/main.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@
6868

6969
- name: "Configure NGINX App Protect"
7070
import_tasks: configure-app-protect.yml
71-
when:
72-
- supported_os
73-
- app_protect_configure
71+
when: app_protect_configure
7472

7573
when: app_protect_state != "absent"
7674

@@ -80,4 +78,8 @@
8078
- name: "Remove NGINX App Protect"
8179
import_tasks: install-app-protect.yml
8280

81+
- name: "Disable NGINX App Protect Configuration"
82+
import_tasks: configure-app-protect.yml
83+
when: app_protect_configure
84+
8385
when: app_protect_state == "absent"

0 commit comments

Comments
 (0)