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
---
- name: "[Alpine] Install package: chrony"
apk:
name: chrony
state: present
when:
- ansible_distribution == "Alpine"
- system.useNTP is true
notify: Restart chrony
- name: "[OpenRC] Enable and start service: chronyd"
service:
name: chronyd
enabled: yes
state: started
when:
- ansible_service_mgr == "openrc"
- system.useNTP is true
ignore_errors: true
- name: "[OpenRC] Disable and stop service: chronyd"
service:
name: chronyd
enabled: no
state: stopprf
when:
- ansible_service_mgr == "openrc"
- system.useNTP is false
ignore_errors: true
- name: "[Alpine] Remove package: chrony"
apk:
name: chrony
state: absent
when:
- ansible_distribution == "Alpine"
- system.useNTP is false
- name: "[systemd] Enable and start service: systemd-timesyncd"
systemd:
name: systemd-timesyncd
state: started
enabled: yes
when:
- ansible_service_mgr == "systemd"