1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
# platform = multi_platform_rhel,multi_platform_rhv,multi_platform_fedora,multi_platform_ol,SUSE Linux Enterprise 15,multi_platform_almalinux
# reboot = false
# strategy = restrict
# complexity = low
# disruption = low
- name: "{{{ rule_title }}} - Find /etc/grub.d/ files"
ansible.builtin.find:
paths:
- /etc/grub.d/
follow: true
register: result_grub_d
- name: "{{{ rule_title }}} - Ensure SELinux Not Disabled in /etc/grub.d/ files"
ansible.builtin.replace:
dest: "{{ item.path }}"
regexp: (selinux|enforcing)=0
with_items:
- "{{ result_grub_d.files }}"
- name: "{{{ rule_title }}} - Check if /etc/grub2.cfg exists"
ansible.builtin.stat:
path: /etc/grub2.cfg
register: result_grub2_cfg_present
- name: "{{{ rule_title }}} - Check if /etc/default/grub exists"
ansible.builtin.stat:
path: /etc/default/grub
register: result_default_grub_present
- name: "{{{ rule_title }}} - Ensure SELinux Not Disabled in /etc/grub2.cfg"
ansible.builtin.replace:
dest: "/etc/grub2.cfg"
regexp: (selinux|enforcing)=0
when:
- result_grub2_cfg_present.stat.exists
- name: "{{{ rule_title }}} - Ensure SELinux Not Disabled in /etc/default/grub"
ansible.builtin.replace:
dest: "/etc/default/grub"
regexp: (selinux|enforcing)=0
when:
- result_default_grub_present.stat.exists
|