diff -uNr cloud-init-0.7.9-orig/cloudinit/config/cc_resolv_conf.py cloud-init-0.7.9/cloudinit/config/cc_resolv_conf.py
--- cloud-init-0.7.9-orig/cloudinit/config/cc_resolv_conf.py 2017-10-16 18:28:37.374850375 +0000
+++ cloud-init-0.7.9/cloudinit/config/cc_resolv_conf.py 2017-10-17 22:46:50.411709013 +0000
@@ -55,10 +55,10 @@
frequency = PER_INSTANCE
-distros = ['fedora', 'rhel', 'sles']
+distros = ['fedora', 'rhel', 'sles', 'photon']
-def generate_resolv_conf(template_fn, params, target_fname="/etc/resolv.conf"):
+def generate_resolv_conf(template_fn, params, target_fname="/etc/systemd/resolved.conf"):
flags = []
false_flags = []
@@ -104,12 +104,13 @@
if "resolv_conf" not in cfg:
log.warn("manage_resolv_conf True but no parameters provided!")
- template_fn = cloud.get_template_filename('resolv.conf')
+ template_fn = cloud.get_template_filename('systemd.resolved.conf')
if not template_fn:
- log.warn("No template found, not rendering /etc/resolv.conf")
+ log.warn("No template found, not rendering /etc/systemd/resolved.conf")
return
generate_resolv_conf(template_fn=template_fn, params=cfg["resolv_conf"])
+ util.subp(["systemctl", "restart", "systemd-resolved"])
return
# vi: ts=4 expandtab
diff -uNr cloud-init-0.7.9-orig/templates/systemd.resolved.conf.tmpl cloud-init-0.7.9/templates/systemd.resolved.conf.tmpl
--- cloud-init-0.7.9-orig/templates/systemd.resolved.conf.tmpl 1970-01-01 00:00:00.000000000 +0000
+++ cloud-init-0.7.9/templates/systemd.resolved.conf.tmpl 2017-10-17 21:35:37.291505255 +0000
@@ -0,0 +1,15 @@
+## template:jinja
+# Your system has been configured with 'manage-resolv-conf' set to true.
+# As a result, cloud-init has written this file with configuration data
+# that it has been provided. Cloud-init, by default, will write this file
+# a single time (PER_ONCE).
+#
+[Resolve]
+LLMNR=false
+{% if nameservers is defined %}
+DNS={% for server in nameservers %}{{server}} {% endfor %}
+{% endif %}
+
+{% if searchdomains is defined %}
+Domains={% for search in searchdomains %}{{search}} {% endfor %}
+{% endif %}