diff net.py @ 15:516a91a3ec08

closer to working netplan
author drewp@bigasterisk.com
date Sat, 13 Nov 2021 12:13:54 -0800
parents 15c5ce7c74b5
children 0c1496e11b8f
line wrap: on
line diff
--- a/net.py	Sat Nov 13 12:13:39 2021 -0800
+++ b/net.py	Sat Nov 13 12:13:54 2021 -0800
@@ -9,6 +9,7 @@
 ssh_host = host.host_data.get('ssh_hostname', host.name)
 
 if is_wifi:
+    # todo: netplan could do this, below
     files.put(src="secrets/wpa_supplicant.conf", dest="/etc/wpa_supplicant/wpa_supplicant.conf")
 
 files.template(src='templates/hosts.j2', dest='/etc/hosts')
@@ -30,15 +31,22 @@
     ns = '10.1.0.1'
 files.template(src='templates/resolv.conf.j2', dest='/etc/resolv.conf', ns=ns)
 
-if host.name in ['dash', 'slash', 'garage', 'frontbed']:
+if host.name in ['dash', 'slash', 'garage', 'frontbed', 'dot']:
     # might need to upgrade pi systemd if there are errors in this part
     apt.packages(packages=['netplan.io'])
-    files.file(path='/etc/netplan/00-installer-config.yaml', present=False)
+    for bad in [
+            '01-netcfg.yaml',
+            '01-network-manager-all.yaml',
+            '00-installer-config.yaml',
+            '99-ansible-written.yaml',
+            '99-dns.conf',
+            ]:
+        files.file(path=f'/etc/netplan/{bad}', present=False)
     addrs = host.get_fact(Ipv4Addrs)
     ipv4Interface = host.host_data['interface']
     ipv4Address = host.host_data['addr']
     files.template(src='templates/netplan.yaml.j2',
-                   dest='/etc/netplan/99-ansible-written.yaml',
+                   dest='/etc/netplan/99-pyinfra-written.yaml',
                    ipv4Interface=ipv4Interface,
                    ipv4Address=ipv4Address)
     server.shell(commands=['netplan apply'])