blob: 69a11587f6c9ba19d6aa9cf3e48dea6e4337c655 [file] [log] [blame]
---
- 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 }}"