diff dns.py @ 70:136d86d06ce6

dns improvements
author drewp@bigasterisk.com
date Sat, 11 Jun 2022 22:53:23 -0700
parents 49a69852a4f4
children 3f7d4626234c
line wrap: on
line diff
--- a/dns.py	Sat Jun 11 22:51:20 2022 -0700
+++ b/dns.py	Sat Jun 11 22:53:23 2022 -0700
@@ -28,6 +28,17 @@
     return dhcp_hosts
 
 
+#files.link('/etc/resolv.conf', '/run/systemd/resolve/stub-resolv.conf')
+
+# files.file(path='/etc/resolv.conf', present=False)
+# files.link(path='/etc/resolv.conf', present=False)  # bug
+# server.shell(["rm -f /etc/resolv.conf"])  # broken fix
+files.template(src='templates/resolv.conf.j2',
+               dest='/etc/resolv.conf',
+               # review this- it's probably a bad dep on bang. maybe both 10.5.0.1 and a public ns would be ok
+               ns='10.5.0.1' if host.name in ['prime', 'plus'] else '10.2.0.1',
+               force=True)
+
 if host.name == 'bang':
     apt.packages(packages=['dnsmasq'])
     systemd.service(service='dnsmasq', enabled=False, running=False)
@@ -46,18 +57,14 @@
                        net=net_name)
         systemd.service(service=f'dnsmasq_{net_name}', enabled=True, restarted=True, daemon_reload=True)
 
-    files.link('/etc/resolv.conf', '/run/systemd/resolve/stub-resolv.conf')
-
 if host.name in [
         'garage',
         'dash',
         'slash',
         'frontbed',
         'prime',
+        'pipe'
 ]:
     files.template(src='templates/hosts.j2', dest='/etc/hosts')
-
-    files.link(path='/etc/resolv.conf', target='/run/systemd/resolve/resolv.conf')
     files.template(src='templates/resolved.conf.j2', dest='/etc/systemd/resolved.conf')
-
     systemd.service(service='systemd-resolved.service', running=True, restarted=True)