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>pull/3480/head
parent
a14bfa282a
commit
b03ab60742
|
@ -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
|
||||
- name: include_tasks setup_ntp.yml
|
||||
include_tasks: setup_ntp.yml
|
||||
when: 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
|
||||
tags: configure_ntp
|
|
@ -1,40 +0,0 @@
|
|||
---
|
||||
- name: setup ntpd
|
||||
block:
|
||||
- name: timedatectl set-ntp no
|
||||
command: timedatectl set-ntp no
|
||||
- name: install ntp
|
||||
package:
|
||||
name: ntp
|
||||
state: present
|
||||
register: result
|
||||
until: result is succeeded
|
||||
- name: start ntp
|
||||
service:
|
||||
name: ntp
|
||||
enabled: yes
|
||||
state: started
|
||||
when: ntp_daemon_type == "ntpd"
|
||||
|
||||
- name: setup chrony
|
||||
block:
|
||||
- name: timedatectl set-ntp no
|
||||
command: timedatectl set-ntp no
|
||||
- name: install chrony
|
||||
package:
|
||||
name: chrony
|
||||
state: present
|
||||
register: result
|
||||
until: result is succeeded
|
||||
- name: start chronyd
|
||||
service:
|
||||
name: chronyd
|
||||
enabled: yes
|
||||
state: started
|
||||
when: ntp_daemon_type == "chronyd"
|
||||
|
||||
- name: setup timesyncd
|
||||
block:
|
||||
- name: timedatectl set-ntp on
|
||||
command: timedatectl set-ntp on
|
||||
when: ntp_daemon_type == "timesyncd"
|
|
@ -1,40 +0,0 @@
|
|||
---
|
||||
- name: setup ntpd
|
||||
block:
|
||||
- name: timedatectl set-ntp no
|
||||
command: timedatectl set-ntp no
|
||||
- name: install ntp
|
||||
package:
|
||||
name: ntp
|
||||
state: present
|
||||
register: result
|
||||
until: result is succeeded
|
||||
- name: start ntp
|
||||
service:
|
||||
name: ntpd
|
||||
enabled: yes
|
||||
state: started
|
||||
when: ntp_daemon_type == "ntpd"
|
||||
|
||||
- name: setup chrony
|
||||
block:
|
||||
- name: timedatectl set-ntp no
|
||||
command: timedatectl set-ntp no
|
||||
- name: install chrony
|
||||
package:
|
||||
name: chrony
|
||||
state: present
|
||||
register: result
|
||||
until: result is succeeded
|
||||
- name: start chrony
|
||||
service:
|
||||
name: chronyd
|
||||
enabled: yes
|
||||
state: started
|
||||
when: ntp_daemon_type == "chronyd"
|
||||
|
||||
- name: setup timesyncd
|
||||
block:
|
||||
- name: timedatectl set-ntp on
|
||||
command: timedatectl set-ntp on
|
||||
when: ntp_daemon_type == "timesyncd"
|
|
@ -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