From 114078bfa186c67ad26bbe4dbf526afe0a8872e2 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Wed, 12 Jun 2019 14:39:44 +0530 Subject: [PATCH] ceph-infra: make chronyd default NTP daemon Since timesyncd is not available on RHEL-based OSs, change the default to chronyd for RHEL-based OSs. Also, chronyd is chrony on Ubuntu, so set the Ansible fact accordingly. Fixes: https://github.com/ceph/ceph-ansible/issues/3628 Signed-off-by: Rishabh Dave (cherry picked from commit 9d88d3199fd8c6548a56bf9e95cd9239481baa39) --- group_vars/all.yml.sample | 2 +- group_vars/rhcs.yml.sample | 2 +- roles/ceph-defaults/defaults/main.yml | 2 +- roles/ceph-facts/tasks/facts.yml | 24 ++++++++++++++++++++++++ roles/ceph-infra/tasks/setup_ntp.yml | 2 +- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/group_vars/all.yml.sample b/group_vars/all.yml.sample index 2ed2fb3c8..cee636e61 100644 --- a/group_vars/all.yml.sample +++ b/group_vars/all.yml.sample @@ -105,7 +105,7 @@ dummy: # 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 +#ntp_daemon_type: chronyd # Set uid/gid to default '64045' for bootstrap directories. diff --git a/group_vars/rhcs.yml.sample b/group_vars/rhcs.yml.sample index e7c5b5749..e74d71479 100644 --- a/group_vars/rhcs.yml.sample +++ b/group_vars/rhcs.yml.sample @@ -105,7 +105,7 @@ fetch_directory: ~/ceph-ansible-keys # 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 +#ntp_daemon_type: chronyd # Set uid/gid to default '64045' for bootstrap directories. diff --git a/roles/ceph-defaults/defaults/main.yml b/roles/ceph-defaults/defaults/main.yml index 3792c7735..3db347679 100644 --- a/roles/ceph-defaults/defaults/main.yml +++ b/roles/ceph-defaults/defaults/main.yml @@ -97,7 +97,7 @@ 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 +ntp_daemon_type: chronyd # Set uid/gid to default '64045' for bootstrap directories. diff --git a/roles/ceph-facts/tasks/facts.yml b/roles/ceph-facts/tasks/facts.yml index c0c2215ba..331235463 100644 --- a/roles/ceph-facts/tasks/facts.yml +++ b/roles/ceph-facts/tasks/facts.yml @@ -256,3 +256,27 @@ set_fact: osd_pool_default_crush_rule: "{% if crush_rule_variable.rc == 0 %}{{ crush_rule_variable.stdout.split(' = ')[1] }}{% else %}{{ ceph_osd_pool_default_crush_rule }}{% endif %}" when: ceph_conf.stat.exists + +- name: set ntp service name depending on OS family + block: + - name: set ntp service name for Debian family + set_fact: + ntp_service_name: ntp + when: ansible_os_family == 'Debian' + + - name: set ntp service name for Red Hat family + set_fact: + ntp_service_name: ntpd + when: ansible_os_family in ['RedHat', 'Suse'] + +- name: set chrony daemon name RedHat and Ubuntu based OSs + block: + - name: set chronyd daemon name for RedHat based OSs + set_fact: + chrony_daemon_name: chronyd + when: ansible_os_family in ["RedHat", "Suse"] + + - name: set chronyd daemon name for Ubuntu based OSs + set_fact: + chrony_daemon_name: chrony + when: ansible_os_family == "Debian" diff --git a/roles/ceph-infra/tasks/setup_ntp.yml b/roles/ceph-infra/tasks/setup_ntp.yml index c46d57de7..933a0d198 100644 --- a/roles/ceph-infra/tasks/setup_ntp.yml +++ b/roles/ceph-infra/tasks/setup_ntp.yml @@ -61,7 +61,7 @@ - name: enable chronyd service: - name: chronyd + name: "{{ chrony_daemon_name }}" enabled: yes state: started notify: -- 2.39.5