diff options
author | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2019-03-26 16:10:10 +0100 |
---|---|---|
committer | Bartek Grzybowski <b.grzybowski@partner.samsung.com> | 2019-04-02 15:25:58 +0200 |
commit | 30b2cbf179448d2761af53494a694f4ce986d623 (patch) | |
tree | a25f6eff088a5fcd83cc57ca8b741dc5d76dbeed /ansible/roles/chrony/tasks | |
parent | 53036e8f41f50cb7ebb2346d02442d80bc16ece0 (diff) |
Support time synchronization on hosts
This change introduces functionality to synchronize
infra/kube nodes' clock with external NTP authority.
Configuring external time source is optional, however
default behaviour will be to setup NTP time source on
infra-node and sync kube-nodes clock with it.
It's also possible to setup custom time zone.
Change-Id: I725ce9a306da1977628b6c03d5ff10fca77fb3b0
Issue-ID: OOM-1710
Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
Diffstat (limited to 'ansible/roles/chrony/tasks')
-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 }}" |