File tree 2 files changed +40
-13
lines changed
2 files changed +40
-13
lines changed Original file line number Diff line number Diff line change @@ -16,3 +16,6 @@ clients:
16
16
kafka_topic : green
17
17
" 10.0.42.6 " :
18
18
kafka_topic : blue
19
+ ntpd :
20
+ hosts :
21
+ " 10.0.42.1 " :
Original file line number Diff line number Diff line change 30
30
- no_proxy
31
31
- NO_PROXY
32
32
33
- - name : Set up DNS
34
- ansible.builtin.copy :
33
+ - name : Install Chrony on all hosts
34
+ ansible.builtin.apt :
35
+ name : chrony
36
+
37
+ - name : Configure one machine as an isolated NTP server
38
+ hosts : ntpd
39
+ become : true
40
+ tasks :
41
+ - ansible.builtin.copy :
42
+ content : |
43
+ allow 10.0.42.0/16
44
+ dest : /etc/chrony/conf.d/local.conf
45
+ register : restart_needed
46
+
47
+ - ansible.builtin.copy :
35
48
content : |
36
- nameserver 10.0.0.1
37
- dest : /etc/resolv.conf
49
+ local
50
+ server 10.0.0.1
51
+ dest : /etc/chrony/sources.d/gateway.sources
52
+ register : restart_needed
38
53
39
- - name : Create /etc/systemd/timesyncd.conf.d directory
40
- ansible.builtin.file :
41
- path : /etc/systemd/timesyncd.conf.d
42
- state : directory
54
+ - ansible.builtin.systemd_service :
55
+ name : chrony.service
56
+ state : restarted
57
+ when : restart_needed.changed
43
58
44
- - name : Set up NTP
45
- ansible.builtin.copy :
59
+ - name : Configure all other machines to get their time from the isolated NTP server
60
+ hosts : all:!ntpd
61
+ become : true
62
+ tasks :
63
+
64
+ - ansible.builtin.copy :
46
65
content : |
47
- [Time]
48
- NTP=10.0.0.1
49
- dest : /etc/systemd/timesyncd.conf.d/proxy.conf
66
+ server {{groups.ntpd[0]}} iburst
67
+ dest : /etc/chrony/sources.d/local.sources
68
+ register : restart_needed
69
+
70
+ - ansible.builtin.systemd_service :
71
+ name : chrony.service
72
+ state : restarted
73
+ when : restart_needed.changed
You can’t perform that action at this time.
0 commit comments