From 5d4ce67b8fc1a48e8d7d081722ef1ee2a105aa82 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <Joerg.Sachse@slub-dresden.de>
Date: Tue, 2 Aug 2022 09:04:34 +0200
Subject: [PATCH] fix: uninstall NTPd on all distributions, so use
 system-agnostig package management, remove distro-restrictions and remove
 config file

---
 tasks/configure_ntp.yml                 | 10 +++-------
 tasks/main.yml                          |  1 -
 tasks/migrate_ntpd_to_esxi_timesync.yml |  2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/tasks/configure_ntp.yml b/tasks/configure_ntp.yml
index a9b6294..f344ec8 100644
--- a/tasks/configure_ntp.yml
+++ b/tasks/configure_ntp.yml
@@ -1,10 +1,6 @@
 ---
 # copy module modifies parent directory permissions, when file or directory is copied with owner and group different than root. It is also not idempotent and changes on subsequent runs.
 - name: configure NTP
-  ansible.builtin.copy:
-    src: "etc/ntp.conf"
-    dest: "/etc/ntp.conf"
-    owner: "root"
-    group: "root"
-    mode: "0644"
-  tags: [molecule-idempotence-notest]
+  ansible.builtin.file:
+    path: "/etc/ntp.conf"
+    state: absent
diff --git a/tasks/main.yml b/tasks/main.yml
index ada2ad3..5a005a4 100644
--- a/tasks/main.yml
+++ b/tasks/main.yml
@@ -146,7 +146,6 @@
 
 - name: NTP konfigurieren
   import_tasks: configure_ntp.yml
-  when: ansible_os_family == "RedHat"
   tags: [ntp]
 
 # there's no way to get this task to become idempotent, so we have to skip the test
diff --git a/tasks/migrate_ntpd_to_esxi_timesync.yml b/tasks/migrate_ntpd_to_esxi_timesync.yml
index a9df01b..e9ab4d2 100644
--- a/tasks/migrate_ntpd_to_esxi_timesync.yml
+++ b/tasks/migrate_ntpd_to_esxi_timesync.yml
@@ -1,6 +1,6 @@
 ---
 - name: purge NTPd package
-  ansible.builtin.apt:
+  ansible.builtin.package:
     name: "ntp"
     state: absent
 
-- 
GitLab