]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
Add support for different NTP daemons
authorBenjamin Cherian <benjamin_cherian@amat.com>
Wed, 5 Sep 2018 16:59:50 +0000 (09:59 -0700)
committerSébastien Han <seb@redhat.com>
Mon, 14 Jan 2019 15:37:35 +0000 (16:37 +0100)
Allow user to choose between timesyncd, chronyd and ntpd
Installation will default to timesyncd since it is distributed as
part of the systemd installation for most distros.
Added note indicating NTP daemon type is not used for containerized
deployments.

Fixes issue #3086 on Github

Signed-off-by: Benjamin Cherian <benjamin_cherian@amat.com>
(cherry picked from commit 85071e6e530ddd80df35920d9fbe63047478d66b)

group_vars/all.yml.sample
group_vars/rhcs.yml.sample
roles/ceph-common/tasks/checks/check_mandatory_vars.yml
roles/ceph-common/tasks/misc/ntp_debian.yml
roles/ceph-common/tasks/misc/ntp_rpm.yml
roles/ceph-defaults/defaults/main.yml

index 8241d995a299d364fd9b525889c50753feeae755..a4970b671c7e3bad310dadaa2550d46ce4fcce79 100644 (file)
@@ -105,10 +105,15 @@ dummy:
 # Whether or not to install the ceph-test package.
 #ceph_test: false
 
-# Enable the ntp service by default to avoid clock skew on
-# ceph nodes
+# Enable the ntp service by default to avoid clock skew on ceph nodes
+# Disable if an appropriate NTP client is already installed and configured
 #ntp_service_enabled: true
 
+# Set type of NTP client daemon to use, valid entries are chronyd, ntpd or timesyncd
+# Note that this selection is currently ignored on containerized deployments
+#ntp_daemon_type: timesyncd
+
+
 # Set uid/gid to default '64045' for bootstrap directories.
 # '64045' is used for debian based distros. It must be set to 167 in case of rhel based distros.
 # These values have to be set according to the base OS used by the container image, NOT the host.
index 551a3419c99130e4f329b6d6bdffafbb794e0582..1a31130565a0d3aa01e1088d0a72f8facb82a3d6 100644 (file)
@@ -105,10 +105,15 @@ fetch_directory: ~/ceph-ansible-keys
 # Whether or not to install the ceph-test package.
 #ceph_test: false
 
-# Enable the ntp service by default to avoid clock skew on
-# ceph nodes
+# Enable the ntp service by default to avoid clock skew on ceph nodes
+# Disable if an appropriate NTP client is already installed and configured
 #ntp_service_enabled: true
 
+# Set type of NTP client daemon to use, valid entries are chronyd, ntpd or timesyncd
+# Note that this selection is currently ignored on containerized deployments
+#ntp_daemon_type: timesyncd
+
+
 # Set uid/gid to default '64045' for bootstrap directories.
 # '64045' is used for debian based distros. It must be set to 167 in case of rhel based distros.
 # These values have to be set according to the base OS used by the container image, NOT the host.
index 497378d98d1fff90053f4a83718870b7d22e966d..ee504faf9ff2b9f6843684a5297907a24d28d75a 100644 (file)
     msg: "fqdn configuration is not supported anymore. Use 'use_fqdn_yes_i_am_sure: true' if you really want to use it. See release notes for more details"
   when:
     - mon_use_fqdn or mds_use_fqdn
-    - not use_fqdn_yes_i_am_sure
\ No newline at end of file
+    - not use_fqdn_yes_i_am_sure
+
+- name: validate ntp daemon type
+  fail:
+    msg: "ntp_daemon_type must be one of chronyd, ntpd, or timesyncd"
+  when:
+    - ntp_service_enabled
+    - ntp_daemon_type not in ['chronyd', 'ntpd', 'timesyncd']
+
index f94003d7af224766fd5ab107036821d83950cfe1..f1da045f1e984b7639e3a9d8f647596fd45329c9 100644 (file)
@@ -1,11 +1,29 @@
 ---
-- name: install ntp on debian
-  package:
-    name: ntp
-    state: present
+- name: setup ntpd
+  block:
+    - command: timedatectl set-ntp no
+    - package:
+        name: ntp
+        state: present
+    - service:
+        name: ntp
+        enabled: yes
+        state: started
+  when: ntp_daemon_type == "ntpd"
 
-- name: start the ntp service
-  service:
-    name: ntp
-    enabled: yes
-    state: started
+- name: setup chrony
+  block:
+    - command: timedatectl set-ntp no
+    - package:
+        name: chrony
+        state: present
+    - service:
+        name: chronyd
+        enabled: yes
+        state: started
+  when: ntp_daemon_type == "chronyd"
+
+- name: setup timesyncd
+  block:
+    - command: timedatectl set-ntp on
+  when: ntp_daemon_type == "timesyncd"
index 91d2d7d8a7b6c97fed09fda1f434f8114b84a56c..866667c2b3d54d32af4978a54ca68d282a855520 100644 (file)
@@ -1,11 +1,29 @@
 ---
-- name: install ntp
-  package:
-    name: ntp
-    state: present
+- name: setup ntpd
+  block:
+    - command: timedatectl set-ntp no
+    - package:
+        name: ntp
+        state: present
+    - service:
+        name: ntpd
+        enabled: yes
+        state: started
+  when: ntp_daemon_type == "ntpd"
 
-- name: start the ntp service
-  service:
-    name: ntpd
-    enabled: yes
-    state: started
+- name: setup chrony
+  block:
+    - command: timedatectl set-ntp no
+    - package:
+        name: chrony
+        state: present
+    - service:
+        name: chronyd
+        enabled: yes
+        state: started
+  when: ntp_daemon_type == "chronyd"
+
+- name: setup timesyncd
+  block:
+    - command: timedatectl set-ntp on
+  when: ntp_daemon_type == "timesyncd"
index 4ae97fea44b7edaffb14ba6916a27775e828a982..b66bfe4fab288f09235a84f2507586775f4ed2f0 100644 (file)
@@ -97,10 +97,15 @@ suse_package_dependencies:
 # Whether or not to install the ceph-test package.
 ceph_test: false
 
-# Enable the ntp service by default to avoid clock skew on
-# ceph nodes
+# Enable the ntp service by default to avoid clock skew on ceph nodes
+# Disable if an appropriate NTP client is already installed and configured
 ntp_service_enabled: true
 
+# Set type of NTP client daemon to use, valid entries are chronyd, ntpd or timesyncd
+# Note that this selection is currently ignored on containerized deployments
+ntp_daemon_type: timesyncd
+
+
 # Set uid/gid to default '64045' for bootstrap directories.
 # '64045' is used for debian based distros. It must be set to 167 in case of rhel based distros.
 # These values have to be set according to the base OS used by the container image, NOT the host.