This repository has been archived by the owner on Jun 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 275
/
deploy_ntp.yml
79 lines (69 loc) · 2.03 KB
/
deploy_ntp.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
- hosts: all
tasks:
- name: get facts
setup:
- name: RedHat family Linux distribution - make sure ntp, ntpstat have been installed
yum:
name: "{{ item }}"
state: present
with_items:
- ntp
when:
- ansible_os_family == "RedHat"
- name: RedHat family Linux distribution - make sure ntpdate have been installed
yum:
name: "{{ item }}"
state: present
with_items:
- ntpdate
when:
- ansible_os_family == "RedHat"
- ntp_server is defined
- name: Debian family Linux distribution - make sure ntp, ntpstat have been installed
apt:
name: "{{ item }}"
state: present
with_items:
- ntp
- ntpstat
when:
- ansible_os_family == "Debian"
- name: Debian family Linux distribution - make sure ntpdate have been installed
apt:
name: "{{ item }}"
state: present
with_items:
- ntpdate
when:
- ansible_os_family == "Debian"
- ntp_server is defined
- name: RedHat family Linux distribution - make sure ntpd service has been stopped
service:
name: ntpd
state: stopped
when:
- ansible_os_family == "RedHat"
- ntp_server is defined
- name: Debian family Linux distribution - make sure ntp service has been stopped
service:
name: ntp
state: stopped
when:
- ansible_os_family == "Debian"
- ntp_server is defined
- name: Adjust Time | start to adjust time with {{ ntp_server }}
shell: ntpdate {{ ntp_server }}
when: ntp_server is defined
- name: RedHat family Linux distribution - make sure ntpd service has been started
service:
name: ntpd
state: started
when:
- ansible_os_family == "RedHat"
- name: Debian family Linux distribution - Make sure ntp service has been started
service:
name: ntp
state: started
when:
- ansible_os_family == "Debian"