2022-01-07 09:06:18 +00:00
|
|
|
---
|
|
|
|
|
# Post tasks
|
|
|
|
|
|
2022-02-02 11:25:03 +00:00
|
|
|
- name: Gather the package facts after remediation
|
2023-01-13 12:10:18 +00:00
|
|
|
ansible.builtin.package_facts:
|
2022-02-02 11:25:03 +00:00
|
|
|
manager: auto
|
|
|
|
|
tags:
|
2022-04-05 10:24:47 +01:00
|
|
|
- always
|
2022-02-02 11:25:03 +00:00
|
|
|
|
2023-01-13 12:10:18 +00:00
|
|
|
- name: Update sysctl
|
|
|
|
|
ansible.builtin.template:
|
2022-06-20 17:07:39 +01:00
|
|
|
src: "etc/sysctl.d/{{ item }}.j2"
|
|
|
|
|
dest: "/etc/sysctl.d/{{ item }}"
|
|
|
|
|
owner: root
|
|
|
|
|
group: root
|
|
|
|
|
mode: 0600
|
|
|
|
|
register: sysctl_updated
|
2023-01-13 12:10:18 +00:00
|
|
|
notify: Reload sysctl
|
2023-01-25 09:59:33 +00:00
|
|
|
loop:
|
2022-06-20 17:07:39 +01:00
|
|
|
- 60-kernel_sysctl.conf
|
|
|
|
|
- 60-disable_ipv6.conf
|
|
|
|
|
- 60-netipv4_sysctl.conf
|
|
|
|
|
- 60-netipv6_sysctl.conf
|
2022-01-07 09:06:18 +00:00
|
|
|
when:
|
2022-06-20 17:07:39 +01:00
|
|
|
- sysctl_update
|
|
|
|
|
- not system_is_container
|
|
|
|
|
- "'procps-ng' in ansible_facts.packages"
|
2022-01-07 09:06:18 +00:00
|
|
|
|
2023-01-13 12:10:18 +00:00
|
|
|
- name: Flush handlers
|
|
|
|
|
ansible.builtin.meta: flush_handlers
|
2022-01-07 09:06:18 +00:00
|
|
|
|
2022-04-01 15:26:13 +01:00
|
|
|
- name: POST | reboot system if changes require it and not skipped
|
|
|
|
|
block:
|
|
|
|
|
- name: POST | Reboot system if changes require it and not skipped
|
2023-01-13 12:10:18 +00:00
|
|
|
ansible.builtin.reboot:
|
2022-04-01 15:26:13 +01:00
|
|
|
when:
|
2023-01-13 14:16:15 +00:00
|
|
|
- change_requires_reboot
|
2022-04-01 15:26:13 +01:00
|
|
|
- not skip_reboot
|
|
|
|
|
|
|
|
|
|
- name: POST | Warning a reboot required but skip option set
|
2023-01-13 12:10:18 +00:00
|
|
|
ansible.builtin.debug:
|
2022-07-29 18:28:17 +01:00
|
|
|
msg: "Warning!! changes have been made that require a reboot to be implemented but skip reboot was set - Can affect compliance check results"
|
2022-04-01 15:26:13 +01:00
|
|
|
changed_when: true
|
|
|
|
|
when:
|
2023-01-13 14:16:15 +00:00
|
|
|
- change_requires_reboot
|
2022-04-01 15:26:13 +01:00
|
|
|
- skip_reboot
|
2022-07-29 18:28:17 +01:00
|
|
|
|
|
|
|
|
- name: "POST | Warning a reboot required but skip option set | warning count"
|
2023-01-13 11:05:25 +00:00
|
|
|
ansible.builtin.import_tasks: warning_facts.yml
|
2022-07-29 18:28:17 +01:00
|
|
|
when:
|
2023-01-13 14:16:15 +00:00
|
|
|
- change_requires_reboot
|
2022-07-29 18:28:17 +01:00
|
|
|
- skip_reboot
|
2023-01-13 11:05:25 +00:00
|
|
|
vars:
|
|
|
|
|
warn_control_id: Reboot_required
|
2022-04-01 15:26:13 +01:00
|
|
|
tags:
|
|
|
|
|
- grub
|
|
|
|
|
- level1-server
|
|
|
|
|
- level1-workstation
|
|
|
|
|
- level2-server
|
|
|
|
|
- level2-workstation
|
|
|
|
|
- rhel9cis_section1
|
|
|
|
|
- rhel9cis_section2
|
|
|
|
|
- rhel9cis_section3
|
|
|
|
|
- rhel9cis_section4
|
|
|
|
|
- rhel9cis_section5
|
|
|
|
|
- rhel9cis_section6
|