From 58794c365842d779ba4e826bf837256d29dd69eb Mon Sep 17 00:00:00 2001 From: Nader Ziada Date: Thu, 21 May 2020 12:03:57 -0400 Subject: [PATCH] Add chrony for time sync for Azure image Chrony is the only way to sync time from host using PTP source according to the azure team --- .../ansible/roles/providers/tasks/azure.yml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/images/capi/ansible/roles/providers/tasks/azure.yml b/images/capi/ansible/roles/providers/tasks/azure.yml index f15cd50975..23320e91d7 100644 --- a/images/capi/ansible/roles/providers/tasks/azure.yml +++ b/images/capi/ansible/roles/providers/tasks/azure.yml @@ -19,3 +19,31 @@ vars: packages: - azure-cli + +- name: Ansible apt install chrony + apt: + name: chrony + state: present + when: ansible_distribution == "Ubuntu" + +- name: Configure PTP + lineinfile: + path: /etc/chrony/chrony.conf + create: yes + line: refclock PHC /dev/ptp0 poll 3 dpoll -2 offset 0 + when: ansible_distribution == "Ubuntu" + +- name: Ensure makestep parameter set as per Azure recommendation + lineinfile: + path: /etc/chrony/chrony.conf + regexp: '^makestep' + line: makestep 1.0 -1 + when: ansible_distribution == "Ubuntu" + +- name: Enable chrony.service + systemd: + enabled: yes + state: started + daemon_reload: yes + name: chrony.service + when: ansible_distribution == "Ubuntu"