diff net.py @ 278:4e424a144183

for netboot pi
author drewp@bigasterisk.com
date Sat, 30 Mar 2024 00:15:46 -0700
parents 058c312ffdce
children 0befc8696a07
line wrap: on
line diff
--- a/net.py	Sat Mar 23 14:22:20 2024 -0700
+++ b/net.py	Sat Mar 30 00:15:46 2024 -0700
@@ -1,8 +1,9 @@
 from pyinfra import host
 from pyinfra.operations import apt, files, server, systemd
+from pyinfra.facts.server import Arch, LinuxDistribution
 
-is_wifi = host.name in ['living', 'plus']
-
+is_pi = host.get_fact(LinuxDistribution)['name'] in ['Debian', 'Raspbian GNU/Linux']
+is_wifi = False
 
 def cleanup():
     # past attempts
@@ -39,9 +40,7 @@
 ])
 # needs reboot if this changed
 
-if host.name in ['slash', 'dash', 'dot', 'squib', 'pillow']:
-    pass  # don't break k3s networking! the else-part really breaks it
-else:
+if host.name in ['prime', 'bang', 'pipe', 'ditto']:
     server.sysctl(key='net.ipv6.conf.all.disable_ipv6', value=1, persist=True)
 
     # if is_wifi_pi:
@@ -100,6 +99,9 @@
     
     systemd.service(service='systemd-networkd.service', enabled=True, running=True, restarted=True)
 
-    # TODO this breaks wg on garage, i think. workaround:
-    if host.name == 'garage':
-        server.shell('ip -4 address add 10.5.0.14/24 dev wg0')
+    # delete?
+    # # TODO this breaks wg on garage, i think. workaround:
+    # if host.name == 'garage':
+    #     server.shell('ip -4 address add 10.5.0.14/24 dev wg0')
+else:
+    pass  # don't break working networking!