link.sls 666 B

1234567891011121314151617181920212223
  1. #
  2. # Networking / link
  3. #
  4. # Write an systemd link file for every interface with a MAC
  5. {% for iface, iface_config in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':ifaces', {}).items ()|sort %}
  6. {% if 'mac' in iface_config %}
  7. /etc/systemd/network/42-{{ iface }}.link:
  8. file.managed:
  9. - source: salt://network/systemd-link.tmpl
  10. - template: jinja
  11. interface: {{ iface }}
  12. iface_config: {{ iface_config }}
  13. desc: {{ iface_config.get ('desc', '') }}
  14. - watch_in:
  15. - cmd: update-initramfs
  16. {% endif %}
  17. {% endfor %}
  18. # Rebuild initrd files if neccessary
  19. update-initramfs:
  20. cmd.wait:
  21. - name: /usr/sbin/update-initramfs -k all -u