From 7766d951da2781e5f2dbc0328bbe04d11cbc43cd Mon Sep 17 00:00:00 2001 From: Vlad Romanenko Date: Mon, 8 Nov 2021 10:21:05 +0100 Subject: [PATCH] Mask systemd-timesyncd only when it is loaded (#31) --- tasks/prelim.yml | 9 +++++++++ tasks/section2.yml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tasks/prelim.yml b/tasks/prelim.yml index 69ada8a..b5c60aa 100644 --- a/tasks/prelim.yml +++ b/tasks/prelim.yml @@ -124,6 +124,15 @@ changed_when: false check_mode: false +- name: "PRELIM | Check for systemd-timesyncd service" + shell: "set -o pipefail; + systemctl show systemd-timesyncd | grep LoadState | cut -d = -f 2" + args: + executable: /bin/bash + register: systemd_timesyncd_service_status + changed_when: false + check_mode: false + - name: "PRELIM | Check for avahi-daemon service" shell: "set -o pipefail; systemctl show avahi-daemon | grep LoadState | cut -d = -f 2" diff --git a/tasks/section2.yml b/tasks/section2.yml index 042908a..f6ddaeb 100644 --- a/tasks/section2.yml +++ b/tasks/section2.yml @@ -330,7 +330,7 @@ masked: yes when: - ubuntu2004cis_time_synchronization == "ntp" - - chronyd_service_status.stdout == "loaded" + - systemd_timesyncd_service_status.stdout == "loaded" when: - ubuntu2004cis_rule_2_2_1_1