|
1 | 1 | --- |
2 | | -- name: (WAF) Set supported_os_waf when platform and major/minor version are in the WAF supported platforms dictionary |
3 | | - when: nginx_app_protect_waf_enable | bool and nginx_app_protect_waf_state != "absent" |
4 | | - block: |
5 | | - - name: (WAF) Set fact to true if item present in dictionary |
6 | | - ansible.builtin.set_fact: |
7 | | - supported_os_waf: true |
8 | | - when: |
9 | | - - ansible_distribution | lower in item.key |
10 | | - - ansible_distribution_version | regex_search('\\d+\\.?\\d*') in item.value |
11 | | - loop: "{{ query('dict', nginx_app_protect_waf_linux_families) }}" |
12 | | - |
13 | | - - name: (WAF) Set supported_os_waf to false if fact not defined |
14 | | - ansible.builtin.set_fact: |
15 | | - supported_os_waf: false |
16 | | - when: supported_os_waf is not defined |
17 | | - |
18 | | - - name: (WAF) Abort if the OS / version combination is not supported |
19 | | - ansible.builtin.fail: |
20 | | - msg: NGINX App Protect WAF is not supported on OS family {{ ansible_distribution }} version {{ ansible_distribution_version }} |
21 | | - when: not supported_os_waf |
22 | | - |
23 | | -- name: (DoS) Set supported_os_dos when platform and major/minor version are in the DoS supported platforms dictionary |
24 | | - when: nginx_app_protect_dos_enable | bool and nginx_app_protect_dos_state != "absent" |
25 | | - block: |
26 | | - - name: (DoS) Set fact to true if item present in dictionary |
27 | | - ansible.builtin.set_fact: |
28 | | - supported_os_dos: true |
29 | | - when: |
30 | | - - ansible_distribution | lower in item.key |
31 | | - - ansible_distribution_version | regex_search('\\d+\\.?\\d+') in item.value |
32 | | - loop: "{{ query('dict', nginx_app_protect_dos_linux_families) }}" |
33 | | - |
34 | | - - name: (DoS) Set supported_os_dos to false if fact not defined |
35 | | - ansible.builtin.set_fact: |
36 | | - supported_os_dos: false |
37 | | - when: supported_os_dos is not defined |
| 2 | +- name: (WAF) Check whether you are using a supported NGINX App Protect WAF distribution |
| 3 | + ansible.builtin.assert: |
| 4 | + that: |
| 5 | + - ansible_distribution | lower in nginx_app_protect_waf_linux_families.keys() | list |
| 6 | + - ansible_distribution_version | regex_search('\\d+\\.?\\d*') in nginx_app_protect_waf_linux_families[ansible_distribution | lower] |
| 7 | + success_msg: Your distribution, {{ ansible_distribution }} {{ ansible_distribution_version }}, is supported by NGINX App Protect WAF |
| 8 | + fail_msg: Your distribution, {{ ansible_distribution }} {{ ansible_distribution_version }}, is not supported by NGINX App Protect WAF |
| 9 | + when: |
| 10 | + - nginx_app_protect_waf_enable | bool |
| 11 | + - nginx_app_protect_waf_state != "absent" |
| 12 | + ignore_errors: true # noqa ignore-errors |
38 | 13 |
|
39 | | - - name: (DoS) Abort if the OS / version combination is not supported |
40 | | - ansible.builtin.fail: |
41 | | - msg: NGINX App Protect DoS is not supported on OS family {{ ansible_distribution }} version {{ ansible_distribution_version }} |
42 | | - when: not supported_os_dos |
| 14 | +- name: (DoS) Check whether you are using a supported NGINX App Protect DoS distribution |
| 15 | + ansible.builtin.assert: |
| 16 | + that: |
| 17 | + - ansible_distribution | lower in nginx_app_protect_dos_linux_families.keys() | list |
| 18 | + - ansible_distribution_version | regex_search('\\d+\\.?\\d*') in nginx_app_protect_dos_linux_families[ansible_distribution | lower] |
| 19 | + success_msg: Your distribution, {{ ansible_distribution }} {{ ansible_distribution_version }}, is supported by NGINX App Protect DoS |
| 20 | + fail_msg: Your distribution, {{ ansible_distribution }} {{ ansible_distribution_version }}, is not supported by NGINX App Protect DoS |
| 21 | + when: |
| 22 | + - nginx_app_protect_dos_enable | bool |
| 23 | + - nginx_app_protect_dos_state != "absent" |
| 24 | + ignore_errors: true # noqa ignore-errors |
43 | 25 |
|
44 | | -- name: Abort if installing on RHEL > 7 without subscription details |
| 26 | +- name: Abort if installing NGINX App Protect on RHEL >7 without subscription details |
45 | 27 | ansible.builtin.fail: |
46 | | - msg: NGINX App Protect cannot be installed on OS family {{ ansible_distribution }} version {{ ansible_distribution_version }} without setting the 'nginx_app_protect_use_rhel_subscription_repos' |
47 | | - variable |
| 28 | + msg: NGINX App Protect cannot be installed on {{ ansible_distribution }} {{ ansible_distribution_version }} without setting the 'nginx_app_protect_use_rhel_subscription_repos' variable |
48 | 29 | when: |
49 | 30 | - ansible_distribution == "RedHat" |
50 | | - - ansible_distribution_version | int > 7 |
| 31 | + - ansible_distribution_major_version is version('7', '>') |
51 | 32 | - not nginx_app_protect_use_rhel_subscription_repos | bool |
0 commit comments