|
1 | 1 | ---
|
2 | 2 | - name: (CentOS/RHEL) Install dependencies
|
3 |
| - block: |
4 |
| - - name: (CentOS/RHEL 7) Install dependencies |
5 |
| - ansible.builtin.yum: |
6 |
| - name: |
7 |
| - - policycoreutils-python |
8 |
| - - setools |
9 |
| - when: ansible_facts['distribution_major_version'] is version('8', '!=') |
10 |
| - |
11 |
| - - name: (RHEL 8) Install dependencies |
12 |
| - ansible.builtin.yum: |
13 |
| - name: |
14 |
| - - libselinux-utils |
15 |
| - - policycoreutils |
16 |
| - - selinux-policy-targeted |
17 |
| - when: ansible_facts['distribution_major_version'] is version('8', '==') |
| 3 | + ansible.builtin.yum: |
| 4 | + name: |
| 5 | + - libselinux-utils |
| 6 | + - policycoreutils |
| 7 | + - selinux-policy-targeted |
18 | 8 | when: ansible_facts['os_family'] == "RedHat"
|
19 | 9 |
|
20 | 10 | - name: Set SELinux mode to permissive
|
21 |
| - ansible.builtin.selinux: |
| 11 | + ansible.posix.selinux: |
22 | 12 | state: permissive
|
23 | 13 | policy: targeted
|
24 | 14 |
|
25 | 15 | - name: Allow SELinux HTTP network connections
|
26 |
| - ansible.builtin.seboolean: |
27 |
| - name: httpd_can_network_connect |
28 |
| - state: true |
29 |
| - persistent: true |
30 |
| - |
31 |
| -- name: Allow SELinux HTTP network connections |
32 |
| - ansible.builtin.seboolean: |
33 |
| - name: httpd_can_network_relay |
| 16 | + ansible.posix.seboolean: |
| 17 | + name: "{{ item }}" |
34 | 18 | state: true
|
35 | 19 | persistent: true
|
| 20 | + loop: |
| 21 | + - httpd_can_network_connect |
| 22 | + - httpd_can_network_relay |
36 | 23 |
|
37 | 24 | - name: Allow SELinux TCP connections on specific ports
|
38 | 25 | community.general.seport:
|
|
75 | 62 | when: nginx_selinux_module.changed | bool
|
76 | 63 |
|
77 | 64 | - name: Set SELinux mode to enforcing
|
78 |
| - ansible.builtin.selinux: |
| 65 | + ansible.posix.selinux: |
79 | 66 | state: enforcing
|
80 | 67 | policy: targeted
|
81 | 68 | when: nginx_selinux_enforcing | bool
|
0 commit comments