- name: Gather the package facts
package_facts:
manager: auto
tags:
- CCE-92538-8
- PCI-DSS-Req-10.4.3 - PCI-DSSv4-Req-10.6.2
- configure_strategy
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- service_timesyncd_configured
- name: XCCDF Value var_multiple_time_servers # promote to variable
set_fact:
var_multiple_time_servers: !!str <xccdf-1.2:sub xmlns:xccdf-1.2="http://checklists.nist.gov/xccdf/1.2" idref="xccdf_org.ssgproject.content_value_var_multiple_time_servers" use="legacy"/>
tags:
- always
- name: Configure Systemd Timesyncd Servers - Set Primary NTP Servers
ansible.builtin.set_fact:
preferred_ntp_servers: '{{ var_multiple_time_servers.split(",") | slice(2)| first
| join(",") }}'
when:
- ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
- '"systemd" in ansible_facts.packages'
tags:
- CCE-92538-8
- PCI-DSS-Req-10.4.3
- PCI-DSSv4-Req-10.6.2
- configure_strategy
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- service_timesyncd_configured
- name: Configure Systemd Timesyncd Servers - Set Fallback NTP Servers
ansible.builtin.set_fact:
fallback_ntp_servers: '{{ var_multiple_time_servers.split(",") | slice(2)| list
| last | join(",") }}'
when:
- ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
- '"systemd" in ansible_facts.packages'
tags:
- CCE-92538-8
- PCI-DSS-Req-10.4.3
- PCI-DSSv4-Req-10.6.2
- configure_strategy
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- service_timesyncd_configured
- name: Configure Systemd Timesyncd Servers - Add missing / update wrong records for
NTP servers
ansible.builtin.lineinfile:
path: /etc/systemd/timesyncd.d/oscap-remedy.conf
regexp: ^\s*NTP\s*=
state: present
line: NTP={{ preferred_ntp_servers }}
create: true
when:
- ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
- '"systemd" in ansible_facts.packages'
tags:
- CCE-92538-8
- PCI-DSS-Req-10.4.3
- PCI-DSSv4-Req-10.6.2
- configure_strategy
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- service_timesyncd_configured
- name: Configure Systemd Timesyncd Servers - Add missing / update wrong records for
fallback servers
ansible.builtin.lineinfile:
path: /etc/systemd/timesyncd.d/oscap-remedy.conf
regexp: ^\s*FallbackNTP\s*=
state: present
line: FallbackNTP={{ fallback_ntp_servers }}
create: true
when:
- ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
- '"systemd" in ansible_facts.packages'
tags:
- CCE-92538-8
- PCI-DSS-Req-10.4.3
- PCI-DSSv4-Req-10.6.2
- configure_strategy
- low_complexity
- low_disruption
- medium_severity
- no_reboot_needed
- service_timesyncd_configured
Show more