|
13 | 13 | state: present |
14 | 14 | when: ansible_os_family == "RedHat" |
15 | 15 |
|
16 | | -- name: run Nginx selinux tasks |
| 16 | +- name: Save the current list of packages for Debian/Ubuntu |
| 17 | + shell: dpkg-query -l > /tmp/before.txt |
| 18 | + when: ansible_os_family == "Debian" and ( nginx_modsec3_crs3_keep is undefined or not nginx_modsec3_crs3_keep ) |
| 19 | + |
| 20 | +- name: Save the current list of packages for RHEL/Centos |
| 21 | + shell: rpm -qa > /tmp/before.txt |
| 22 | + when: ansible_os_family == 'RedHat' and ( nginx_modsec3_crs3_keep is undefined or not nginx_modsec3_crs3_keep ) |
| 23 | + |
| 24 | +- name: Installing compiler dependencies for Debian/Ubuntu |
| 25 | + apt: |
| 26 | + name: "{{ nginx_modsec3_crs3_debian_compiler_reqs }}" |
| 27 | + state: present |
| 28 | + when: ansible_os_family == "Debian" |
| 29 | + |
| 30 | +- name: Installing compiler dependencies for RHEL/Centos |
| 31 | + yum: |
| 32 | + name: "{{ nginx_modsec3_crs3_redhat_compiler_reqs }}" |
| 33 | + state: present |
| 34 | + when: ansible_os_family == "Redhat" |
| 35 | + |
| 36 | +- name: Run Nginx SElinux tasks |
17 | 37 | include_role: |
18 | 38 | name: jdauphant.nginx |
19 | 39 | tasks_from: selinux.yml |
20 | 40 | allow_duplicates: yes |
21 | 41 | when: ansible_selinux and ansible_selinux.status == "enabled" |
22 | 42 |
|
23 | | -- name: run Nginx nginx offical repo tasks |
| 43 | +- name: Run Nginx official repo tasks |
24 | 44 | include_role: |
25 | 45 | name: jdauphant.nginx |
26 | 46 | tasks_from: nginx-official-repo.yml |
27 | 47 | allow_duplicates: yes |
28 | 48 | when: nginx_official_repo == True |
29 | 49 |
|
30 | | -- name: run Nginx install packages tasks |
| 50 | +- name: Run Nginx install packages tasks |
31 | 51 | include_role: |
32 | 52 | name: jdauphant.nginx |
33 | 53 | tasks_from: installation.packages.yml |
|
63 | 83 | set_fact: |
64 | 84 | nginx_modsec3_crs3_nginx_version: "{{ ansible_facts.packages.nginx[0].version.split('-')[0] }}" |
65 | 85 |
|
66 | | -- name: Compile ModSecurity3 , install OWAPS CRS3, and build nginx modules |
67 | | - import_tasks: compile.yml |
| 86 | +- name: Get Nginx conf location |
| 87 | + shell: dirname $(nginx -V 2>&1 | grep "configure arguments:" | sed -e 's/.*--conf-path=\([^ ]*\).*/\1/') |
| 88 | + register: _nginx_conf_location |
| 89 | + changed_when: false |
| 90 | + when: nginx_conf_dir is not defined |
68 | 91 |
|
69 | | -- name: Set nginx_conf_dir if not already set |
| 92 | +- name: Set variable nginx_conf_dir |
70 | 93 | set_fact: |
71 | | - nginx_conf_dir: "/etc/nginx" |
| 94 | + nginx_conf_dir: "{{ _nginx_conf_location.stdout }}" |
72 | 95 | when: nginx_conf_dir is not defined |
73 | 96 |
|
74 | 97 | - name: Check if ModSecurity3 is present |
|
0 commit comments