Skip to content

Commit 3b7e7c2

Browse files
author
Jack Williams
authored
Add mention of cloud-init support for NTP
Add honorable mention of cloud-init support for NTP to linux/time-sync.md
1 parent 55f25b4 commit 3b7e7c2

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

articles/virtual-machines/linux/time-sync.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,43 @@ For more information about chrony, see [Using chrony](https://access.redhat.com/
136136

137137
On SUSE and Ubuntu releases before 19.10, time sync is configured using [systemd](https://www.freedesktop.org/wiki/Software/systemd/). For more information about Ubuntu, see [Time Synchronization](https://help.ubuntu.com/lts/serverguide/NTP.html). For more information about SUSE, see Section 4.5.8 in [SUSE Linux Enterprise Server 12 SP3 Release Notes](https://www.suse.com/releasenotes/x86_64/SUSE-SLES/12-SP3/#InfraPackArch.ArchIndependent.SystemsManagement).
138138

139+
### cloud-init
140+
141+
Images that use cloud-init to provision the VM can use the ntp section to setup a time sync service. An example of cloud-init installing chrony and configuring it to use the PTP clock source for Ubuntu VMs:
142+
143+
```yaml
144+
#cloud-config
145+
ntp:
146+
enabled: true
147+
ntp_client: chrony
148+
config:
149+
confpath: /etc/chrony/chrony.conf
150+
packages:
151+
- chrony
152+
service_name: chrony
153+
template: |
154+
## template:jinja
155+
driftfile /var/lib/chrony/chrony.drift
156+
logdir /var/log/chrony
157+
maxupdateskey 100.0
158+
refclock PHC /dev/ptp_hyperv poll 3 dpoll -2
159+
makestep 1.0 -1
160+
```
161+
162+
You can then base64 the above cloud-config for use in the `osProfile` section in an ARM template:
163+
164+
```powershell
165+
[Convert]::ToBase64String((Get-Content -Path ./cloud-config.txt -Encoding Byte))
166+
```
167+
168+
```json
169+
"osProfile": {
170+
"customData": "I2Nsb3VkLWNvbmZpZwpudHA6CiAgZW5hYmxlZDogdHJ1ZQogIG50cF9jbGllbnQ6IGNocm9ueQogIGNvbmZpZzoKICAgIGNvbmZwYXRoOiAvZXRjL2Nocm9ueS9jaHJvbnkuY29uZgogICAgcGFja2FnZXM6CiAgICAgLSBjaHJvbnkKICAgIHNlcnZpY2VfbmFtZTogY2hyb255CiAgICB0ZW1wbGF0ZTogfAogICAgICAgIyMgdGVtcGxhdGU6amluamEKICAgICAgIGRyaWZ0ZmlsZSAvdmFyL2xpYi9jaHJvbnkvY2hyb255LmRyaWZ0CiAgICAgICBsb2dkaXIgL3Zhci9sb2cvY2hyb255CiAgICAgICBtYXh1cGRhdGVza2V5IDEwMC4wCiAgICAgICByZWZjbG9jayBQSEMgL2Rldi9wdHBfaHlwZXJ2IHBvbGwgMyBkcG9sbCAtMgogICAgICAgbWFrZXN0ZXAgMS4wIC0x"
171+
}
172+
```
173+
174+
For more information about cloud-init on Azure, see [Overview of cloud-init support for Linux VMs in Azure](./using-cloud-init.md).
175+
139176
## Next steps
140177

141178
For more information, see [Accurate time for Windows Server 2016](/windows-server/networking/windows-time-service/accurate-time).

0 commit comments

Comments
 (0)