diff options
author | 2019-04-03 10:27:40 +0000 | |
---|---|---|
committer | 2019-04-03 10:27:40 +0000 | |
commit | cdd93f561042f5ee4df72895e33bc02a122d5104 (patch) | |
tree | a66a32e0e4a1c78c9b67d5e8cecee9e5b4270d11 /ansible/roles/chrony/tasks/main.yml | |
parent | 6969393c445e5a86a6e788cff989c4af06ca84ad (diff) | |
parent | 30b2cbf179448d2761af53494a694f4ce986d623 (diff) |
Merge "Support time synchronization on hosts"
Diffstat (limited to 'ansible/roles/chrony/tasks/main.yml')
-rw-r--r-- | ansible/roles/chrony/tasks/main.yml | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ansible/roles/chrony/tasks/main.yml b/ansible/roles/chrony/tasks/main.yml new file mode 100644 index 00000000..69a11587 --- /dev/null +++ b/ansible/roles/chrony/tasks/main.yml @@ -0,0 +1,26 @@ +--- +- 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 }}" |