link.sls 890 B

1234567891011121314151617181920212223242526272829303132333435
  1. #
  2. # Networking / link
  3. #
  4. {% if grains['oscodename'] == 'jessie' %}
  5. # Udev rules
  6. /etc/udev/rules.d/42-ffho-net.rules:
  7. file.managed:
  8. - template: jinja
  9. - source: salt://network/udev-rules.tmpl
  10. # Stretch, Buster, ...
  11. {% else %}
  12. # Write an systemd link file for every interface with a MAC
  13. {% for iface, iface_config in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':ifaces', {}).items ()|sort %}
  14. {% if 'mac' in iface_config %}
  15. /etc/systemd/network/42-{{ iface }}.link:
  16. file.managed:
  17. - source: salt://network/systemd-link.tmpl
  18. - template: jinja
  19. interface: {{ iface }}
  20. iface_config: {{ iface_config }}
  21. desc: {{ iface_config.get ('desc', '') }}
  22. - watch_in:
  23. - cmd: update-initramfs
  24. {% endif %}
  25. {% endfor %}
  26. {% endif %}
  27. # Rebuild initrd files if neccessary
  28. update-initramfs:
  29. cmd.wait:
  30. - name: /usr/sbin/update-initramfs -k all -u