Fix for #12435 - setting timezone under SELinux. (#12436)

Signed-off-by: Bas Meijer <bas.meijer@enexis.nl>
This commit is contained in:
Bas 2025-12-24 12:10:31 +01:00 committed by GitHub
parent b7491b957b
commit e80087df93
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -74,8 +74,33 @@
- not is_fedora_coreos
- not ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"]
- name: Set timezone
- name: Gather selinux facts
ansible.builtin.setup:
gather_subset: selinux
when:
- ntp_timezone
- ansible_os_family == "RedHat"
- name: Put SELinux in permissive mode, logging actions that would be blocked.
ansible.posix.selinux:
policy: targeted
state: permissive
when:
- ntp_timezone
- ansible_os_family == "RedHat"
- ansible_facts.selinux.mode == 'enforcing'
- name: Set ntp_timezone
community.general.timezone:
name: "{{ ntp_timezone }}"
when:
- ntp_timezone
- name: Re-enable SELinux
ansible.posix.selinux:
policy: targeted
state: "{{ preinstall_selinux_state }}"
when:
- ntp_timezone
- ansible_os_family == "RedHat"
- ansible_facts.selinux.status == 'enabled'