Преглед на файлове

Disable systemd NTP client when ntpd is running

Markus Lindenberg преди 8 години
родител
ревизия
e49967ea34
променени са 4 файла, в които са добавени 15 реда и са изтрити 7 реда
  1. 7 0
      roles/common-ntpclient/tasks/main.yml
  2. 0 6
      roles/common-system/tasks/time.yml
  3. 6 0
      roles/service-ntp/tasks/main.yml
  4. 2 1
      site.yml

+ 7 - 0
roles/common-ntpclient/tasks/main.yml

@@ -0,0 +1,7 @@
+---
+
+- name: ensure systemd NTP client is enabled
+  shell: "timedatectl | grep 'NTP enabled: yes' || timedatectl set-ntp 1"
+  register: ntp_shell_result
+  changed_when: "ntp_shell_result.stdout == '' and ntp_shell_result.rc == 0"
+  failed_when: "ntp_shell_result.rc != 0"

+ 0 - 6
roles/common-system/tasks/time.yml

@@ -6,9 +6,3 @@
 - name: ensure timezone is set to CET
   command: timedatectl set-timezone CET
   when: ansible_date_time.tz != "CET"
-
-- name: ensure NTP is enabled
-  shell: "timedatectl | grep 'NTP enabled: yes' || timedatectl set-ntp 1"
-  register: ntp_shell_result
-  changed_when: "ntp_shell_result.stdout == '' and ntp_shell_result.rc == 0"
-  failed_when: "ntp_shell_result.rc != 0"

+ 6 - 0
roles/service-ntp/tasks/main.yml

@@ -1,5 +1,11 @@
 ---
 
+- name: ensure systemd NTP client is disabled
+  shell: "timedatectl | grep 'NTP enabled: no' || timedatectl set-ntp 0"
+  register: ntp_shell_result
+  changed_when: "ntp_shell_result.stdout == '' and ntp_shell_result.rc == 0"
+  failed_when: "ntp_shell_result.rc != 0"
+
 - name: Ensure ntp is installed
   apt: name=ntp
 

+ 2 - 1
site.yml

@@ -18,12 +18,13 @@
 #     - gateway-nat
     - mesh-batman
     - mesh-vpn-fastd
-    - service-dns
     - service-ntp
+    - service-dns
     - service-dhcp
 
 # - hosts: mapservers
 #   roles:
+#     - common-ntpclient
 #     - service-nginx
 #     - service-map
 #     - service-wiki