mirror of https://github.com/ceph/ceph-ansible.git
ceph-infra: merge ntp_debian.yml and ntp_rpm.yml
Merge ntp_debian.yml and ntp_rpm.yml into one (the new file is called
setup_ntp.yml) since they are almost identical. Also avoid repetition
of the common setup step for ntpd and chronyd services.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit b03ab60742
)
# Conflicts:
# roles/ceph-infra/tasks/ntp_debian.yml
# roles/ceph-infra/tasks/ntp_rpm.yml
pull/3478/head
parent
668c7a4db7
commit
488281187e
|
@ -6,16 +6,7 @@
|
|||
- ansible_os_family in ['RedHat', 'Suse']
|
||||
tags: configure_firewall
|
||||
|
||||
- name: include_tasks "ntp_debian.yml"
|
||||
include_tasks: "ntp_debian.yml"
|
||||
when:
|
||||
- ansible_os_family == 'Debian'
|
||||
- ntp_service_enabled
|
||||
tags: configure_ntp
|
||||
|
||||
- name: include_tasks "ntp_rpm.yml"
|
||||
include_tasks: "ntp_rpm.yml"
|
||||
when:
|
||||
- ansible_os_family in ['RedHat', 'Suse']
|
||||
- ntp_service_enabled
|
||||
- name: include_tasks setup_ntp.yml
|
||||
include_tasks: setup_ntp.yml
|
||||
when: ntp_service_enabled
|
||||
tags: configure_ntp
|
|
@ -0,0 +1,51 @@
|
|||
---
|
||||
- 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: setup ntp daemon
|
||||
block:
|
||||
- name: install and enable timesyncd
|
||||
command: timedatectl set-ntp on
|
||||
when: ntp_daemon_type == "timesyncd"
|
||||
|
||||
- name: disable time sync using timesyncd if we are not using it
|
||||
command: timedatectl set-ntp no
|
||||
when: ntp_daemon_type != "timesyncd"
|
||||
|
||||
- name: setup ntpd
|
||||
when: ntp_daemon_type == "ntpd"
|
||||
block:
|
||||
- name: install ntp
|
||||
package:
|
||||
name: ntp
|
||||
state: present
|
||||
register: result
|
||||
until: result is succeeded
|
||||
- name: enable and start ntp
|
||||
service:
|
||||
name: "{{ ntp_service_name }}"
|
||||
enabled: yes
|
||||
state: started
|
||||
|
||||
- name: setup chronyd
|
||||
when: ntp_daemon_type == "chronyd"
|
||||
block:
|
||||
- name: install chrony
|
||||
package:
|
||||
name: chrony
|
||||
state: present
|
||||
register: result
|
||||
until: result is succeeded
|
||||
- name: enable and start chronyd
|
||||
service:
|
||||
name: chronyd
|
||||
enabled: yes
|
||||
state: started
|
Loading…
Reference in New Issue