|
43 | 43 | changed_when: false
|
44 | 44 | when: __sap_general_preconfigure_fact_selinux_mode != sap_general_preconfigure_selinux_state
|
45 | 45 |
|
46 |
| -- name: Set or unset SELinux kernel parameter, RHEL 8 and RHEL 9 |
| 46 | +- name: Set or unset SELinux kernel parameter, RHEL >= 8 |
47 | 47 | when:
|
48 | 48 | - ansible_os_family == 'RedHat'
|
49 |
| - - ( ansible_distribution_major_version == '8' or |
50 |
| - ansible_distribution_major_version == '9' |
51 |
| - ) |
| 49 | + - ansible_distribution_major_version | int >= 8 |
52 | 50 | block:
|
53 | 51 |
|
54 | 52 | - name: SELinux - Examine grub entries
|
|
57 | 55 | check_mode: false
|
58 | 56 | changed_when: false
|
59 | 57 |
|
60 |
| - - name: Disable SELinux on the kernel command line, RHEL 8 and RHEL 9 |
| 58 | + - name: Disable SELinux on the kernel command line, RHEL >= 8 |
61 | 59 | when:
|
62 | 60 | - sap_general_preconfigure_selinux_state == 'disabled'
|
63 | 61 | - __sap_general_preconfigure_register_grubby_info_all_selinux.stdout.split(' ').1 !=
|
|
67 | 65 | # If the number of grub entries for args is different from the number of grub entries with "selinux=0",
|
68 | 66 | # we know that at least one grub entry is missing "selinux=0", so we make sure that all grub entries
|
69 | 67 | # contain "selinux=0"
|
70 |
| - - name: Disable SELinux also on the kernel command line, RHEL 8 and RHEL 9 |
| 68 | + - name: Disable SELinux also on the kernel command line, RHEL >= 8 |
71 | 69 | ansible.builtin.command: grubby --args="selinux=0" --update-kernel=ALL
|
72 | 70 | notify: __sap_general_preconfigure_reboot_handler
|
73 | 71 | changed_when: true
|
|
77 | 75 | ansible.builtin.set_fact:
|
78 | 76 | sap_general_preconfigure_fact_reboot_required: true
|
79 | 77 |
|
80 |
| - - name: Enable SELinux on the kernel command line, RHEL 8 and RHEL 9 |
| 78 | + - name: Enable SELinux on the kernel command line, RHEL >= 8 |
81 | 79 | when:
|
82 | 80 | - sap_general_preconfigure_selinux_state == 'enforcing' or
|
83 | 81 | sap_general_preconfigure_selinux_state == 'permissive'
|
|
86 | 84 |
|
87 | 85 | # If the number of grub entries for args with "selinux=0" is not 0, we know that there is at least
|
88 | 86 | # one grub entry with "selinux=0", so we make sure that no grub entry contains "selinux=0"
|
89 |
| - - name: Make sure SELinux is not disabled on the kernel command line, RHEL 8 and RHEL 9 |
| 87 | + - name: Make sure SELinux is not disabled on the kernel command line, RHEL >= 8 |
90 | 88 | ansible.builtin.command: grubby --remove-args="selinux" --update-kernel=ALL
|
91 | 89 | notify: __sap_general_preconfigure_reboot_handler
|
92 | 90 | changed_when: true
|
|
0 commit comments