Browse Source

Add state for network bootstrapping from withing the installer.

  The network.bootstrap state will create systemd link files, install ifupdown2
  and write /etc/network/interfaces but will not reload touch any interfaces.

  This way there will be a clean network config when the machine boots for the
  first time and will therefore be reachable within the Freifunk network.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 4 years ago
parent
commit
5076536a48
3 changed files with 45 additions and 27 deletions
  1. 9 0
      network/bootstrap.sls
  2. 34 0
      network/interfaces/base.sls
  3. 2 27
      network/interfaces/init.sls

+ 9 - 0
network/bootstrap.sls

@@ -0,0 +1,9 @@
+#
+# To be called from pressed
+#
+
+include:
+ - network.link
+ - network.interfaces.base
+
+

+ 34 - 0
network/interfaces/base.sls

@@ -0,0 +1,34 @@
+#
+# network.interface.base
+#
+
+# Install required packets and write /etc/network/interfaces but don't apply it!
+
+ifupdown2:
+  pkg.installed
+
+# Require for some functions of ffho_net module, so make sure they are present.
+# Used by functions for bird and dhcp-server for example.
+python-ipcalc:
+  pkg.installed
+
+# ifupdown2 configuration
+/etc/network/ifupdown2/ifupdown2.conf:
+  file.managed:
+    - source:
+      - salt://network/ifupdown2.conf.{{ grains['oscodename'] }}
+      - salt://network/ifupdown2.conf
+    - require:
+      - pkg: ifupdown2
+      - pkg: python-ipcalc
+
+
+# Write network configuration
+/etc/network/interfaces:
+ file.managed:
+    - template: jinja
+    - source: salt://network/interfaces/interfaces.tmpl
+    - require:
+      - pkg: ifupdown2
+
+

+ 2 - 27
network/interfaces/init.sls

@@ -2,33 +2,8 @@
 # /etc/network/interfaces
 #
 
-ifupdown2:
-  pkg.installed
-
-# Require for some functions of ffho_net module, so make sure they are present.
-# Used by functions for bird and dhcp-server for example.
-python-ipcalc:
-  pkg.installed
-
-# ifupdown2 configuration
-/etc/network/ifupdown2/ifupdown2.conf:
-  file.managed:
-    - source:
-      - salt://network/ifupdown2.conf.{{ grains['oscodename'] }}
-      - salt://network/ifupdown2.conf
-    - require:
-      - pkg: ifupdown2
-      - pkg: python-ipcalc
-
-
-# Write network configuration
-/etc/network/interfaces:
- file.managed:
-    - template: jinja
-    - source: salt://network/interfaces/interfaces.tmpl
-    - require:
-      - pkg: ifupdown2
-
+include:
+ - network.interfaces.base
 
 # Reload interface configuration if neccessary
 ifreload: