Skip to content

Commit ae87c4d

Browse files
committed
inital commit
1 parent c0597cb commit ae87c4d

File tree

4 files changed

+55
-56
lines changed

4 files changed

+55
-56
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ This is a sample playbook file for using the role to install NGINX App Protect o
9191
- hosts: wafs
9292
become: true
9393
vars:
94-
# Installs NGINX App Protect and all dependencies to the target host
95-
app_protect_enable: true
9694
9795
# Specify whether you want to maintain your version of NGINX App Protect, upgrade to the latest version, or remove NGINX App Protect.
9896
# Can be used with `app_protect_version` to achieve fine grained control on which version of NGINX App Protect is installed/used on each playbook execution.

defaults/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
---
22
# defaults file for ansible-role-nginx-app-protect
33

4-
# Installs NGINX App Protect and all dependencies to the target host
5-
app_protect_enable: true
6-
74
# Specify whether you want to maintain your version of NGINX App Protect, upgrade to the latest version, or remove NGINX App Protect.
85
# Can be used with `app_protect_version` to achieve fine grained control on which version of NGINX App Protect is installed/used on each playbook execution.
96
# Using 'present' will install the latest version (or 'app_protect_version') of NGINX App Protect on a fresh install.

tasks/install-app-protect-linux.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,3 @@
1010
name: "app-protect{{ nginx_version | default('') }}"
1111
state: "{{ app_protect_state }}"
1212
notify: "(Handler: All OSs) Restart NGINX"
13-
14-
# - name: "Start NGINX App Protect"
15-
# service:
16-
# name: nginx-app-protect
17-
# state: started
18-
# enabled: true
19-
# when:
20-
# - not ansible_check_mode
21-
22-
# - name: "Start NGINX"
23-
# service:
24-
# name: nginx
25-
# state: reloaded
26-
# when:
27-
# - not ansible_check_mode

tasks/main.yml

Lines changed: 55 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,63 @@
2121
msg: "supported_os {{ supported_os }}"
2222
verbosity: 2
2323

24+
- name: Debug app_protect_state
25+
debug:
26+
msg: "app_protect_state {{ app_protect_state }}"
27+
2428
- name: Abort if the OS/version combination is not supported
2529
fail:
2630
msg: "NGINX App Protect is not supported on os family {{ ansible_distribution }} version {{ ansible_distribution_version }}"
2731
when: not supported_os
2832

29-
- include_tasks: prerequisites/install-prerequisites.yml
30-
tags: nginx_prerequisites
31-
32-
- import_tasks: keys/apt-key.yml
33-
when:
34-
- ansible_os_family == "Debian"
35-
- app_protect_install_signatures
36-
tags: nginx_aptkey
37-
38-
- import_tasks: keys/rpm-key.yml
39-
when:
40-
- ansible_os_family == "RedHat"
41-
- app_protect_install_signatures
42-
tags: nginx_rpmkey
43-
44-
- name: "(All OSs) Setup license"
45-
include_tasks: setup-license.yml
46-
when: app_protect_enable or app_protect_install_signatures
47-
48-
- name: "NGINX App Protect"
49-
include_tasks: install-app-protect.yml
50-
when: supported_os and app_protect_enable
51-
52-
- name: "NGINX App Protect Signatures"
53-
include_tasks: install-signatures.yml
54-
when: supported_os and app_protect_install_signatures
55-
56-
- name: "Remove license"
57-
include_tasks: delete-license.yml
58-
when:
59-
- app_protect_delete_license
60-
tags: app_protect_delete_license
61-
62-
- name: "Configure NGINX Plus App Protect"
63-
include_tasks: configure-app-protect.yml
64-
when: supported_os and app_protect_configure
33+
34+
- name: "Install NGINX App Protect"
35+
block:
36+
37+
- include_tasks: prerequisites/install-prerequisites.yml
38+
tags: nginx_prerequisites
39+
40+
- import_tasks: keys/apt-key.yml
41+
when:
42+
- ansible_os_family == "Debian"
43+
- app_protect_install_signatures
44+
tags: nginx_aptkey
45+
46+
- import_tasks: keys/rpm-key.yml
47+
when:
48+
- ansible_os_family == "RedHat"
49+
- app_protect_install_signatures
50+
tags: nginx_rpmkey
51+
52+
- name: "(All OSs) Setup license"
53+
import_tasks: setup-license.yml
54+
when: app_protect_install_signatures
55+
56+
- name: "Install NGINX App Protect"
57+
import_tasks: install-app-protect.yml
58+
59+
- name: "NGINX App Protect Signatures"
60+
import_tasks: install-signatures.yml
61+
when: app_protect_install_signatures
62+
63+
- name: "Remove license"
64+
import_tasks: delete-license.yml
65+
when:
66+
- app_protect_delete_license
67+
tags: app_protect_delete_license
68+
69+
- name: "Configure NGINX App Protect"
70+
import_tasks: configure-app-protect.yml
71+
when:
72+
- supported_os
73+
- app_protect_configure
74+
75+
when: app_protect_state != absent
76+
77+
- name: "Remove NGINX App Protect"
78+
block:
79+
80+
- name: "Remove NGINX App Protect"
81+
import_tasks: install-app-protect.yml
82+
83+
when: app_protect_state == absent

0 commit comments

Comments
 (0)