Browse Source

network: Rebuild initrd files when updating systemd link files.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
Maximilian Wilhelm 3 years ago
parent
commit
afe4580f10
1 changed files with 9 additions and 1 deletions
  1. 9 1
      network/link.sls

+ 9 - 1
network/link.sls

@@ -12,7 +12,7 @@
 # Stretch, Buster, ...
 {% else %}
 
-# Systemd link files?
+# Write an systemd link file for every interface with a MAC
   {% for iface, iface_config in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':ifaces', {}).items ()|sort %}
     {% if 'mac' in iface_config %}
 /etc/systemd/network/42-{{ iface }}.link:
@@ -22,6 +22,14 @@
       interface: {{ iface }}
       iface_config: {{ iface_config }}
       desc: {{ iface_config.get ('desc', '') }}
+    - watch_in:
+      - cmd: update-initramfs
     {% endif %}
   {% endfor %}
 {% endif %}
+
+
+# Rebuild initrd files if neccessary
+update-initramfs:
+  cmd.wait:
+    - name: /usr/sbin/update-initramfs -k all -u