summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2017-08-01 18:00:00 -0500
committerScott Moser <smoser@brickies.net>2017-08-04 10:35:47 -0400
commit5bba5db2655d88b8aba8fa06b30f8e91e2ca6836 (patch)
tree38b223a8e12f184e0085529bbbfe0334d8065d5d /templates
parent9d923c1ab9c4556b980509513ece4a414269b5b9 (diff)
downloadcloud-init-git-5bba5db2655d88b8aba8fa06b30f8e91e2ca6836.tar.gz
cc_ntp: fallback on timesyncd configuration if ntp is not installable
Some systems like Ubuntu-Core do not provide an ntp package for installation but do include systemd-timesyncd (an ntp client). On such systems cloud-init will generate a timesyncd configuration using the 'servers' and 'pools' values as ntp hosts for timesyncd to use. LP: #1686485
Diffstat (limited to 'templates')
-rw-r--r--templates/timesyncd.conf.tmpl8
1 files changed, 8 insertions, 0 deletions
diff --git a/templates/timesyncd.conf.tmpl b/templates/timesyncd.conf.tmpl
new file mode 100644
index 00000000..6b98301d
--- /dev/null
+++ b/templates/timesyncd.conf.tmpl
@@ -0,0 +1,8 @@
+## template:jinja
+# cloud-init generated file
+# See timesyncd.conf(5) for details.
+
+[Time]
+{% if servers or pools -%}
+NTP={% for host in servers|list + pools|list %}{{ host }} {% endfor -%}
+{% endif -%}