blob: ae95c8e7eebd4ea420058c4b36a473179c3aa7fe (
plain)
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
|
---
- name: Install Chrony - Ubuntu
package:
name: "chrony"
state: present
when: ansible_distribution in ["Ubuntu","Debian"]
- name: Check if server mode
set_fact:
chrony_mode: 'server'
when: "'infrastructure' in group_names and timesync.servers is not defined"
- name: Check if client mode
set_fact:
chrony_mode: 'client'
when: "timesync.servers is defined or 'infrastructure' not in group_names"
- name: "Upload chronyd {{ chrony_mode }} configuration"
template:
src: "chrony.conf.j2"
dest: "{{ chrony['conf'][ansible_os_family]['config_file'] }}"
notify: Restart chronyd
- name: Ensure chronyd is enabled/running
systemd:
name: chronyd
state: started
enabled: true
- name: Setup timezone
timezone:
name: "{{ chrony.timezone }}"
|