init.sls 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #
  2. # Networking
  3. #
  4. include:
  5. - apt
  6. - network.interfaces
  7. network-pkg:
  8. pkg.installed:
  9. - pkgs:
  10. - bridge-utils
  11. - vlan
  12. - tcpdump
  13. - mtr-tiny
  14. - iperf
  15. - host
  16. - dnsutils
  17. - ipv6calc
  18. - require_in:
  19. - file: /etc/network/interfaces
  20. # - require:
  21. # - APT-FFHO
  22. iproute2:
  23. pkg.latest
  24. vnstat:
  25. pkg.installed:
  26. - name: vnstat
  27. service.running:
  28. - restart: True
  29. /etc/vnstat.conf:
  30. file.managed:
  31. - source: salt://network/vnstat.conf
  32. - watch_in:
  33. - service: vnstat
  34. # Udev rules
  35. /etc/udev/rules.d/42-ffho-net.rules:
  36. file.managed:
  37. - template: jinja
  38. - source: salt://network/udev-rules.tmpl
  39. # Systemd link files?
  40. {% if grains['oscodename'] == 'stretch' %}
  41. {% for iface, iface_config in salt['pillar.get']('nodes:' ~ grains['id'] ~ ':ifaces', {}).items ()|sort %}
  42. {% if '_udev_mac' in iface_config %}
  43. /etc/systemd/network/42-{{ iface }}.link:
  44. file.managed:
  45. - source: salt://network/systemd-link.tmpl
  46. - template: jinja
  47. interface: {{ iface }}
  48. mac: {{ iface_config.get ('_udev_mac') }}
  49. desc: {{ iface_config.get ('desc', '') }}
  50. {% endif %}
  51. {% endfor %}
  52. {% endif %}
  53. # /etc/resolv.conf
  54. /etc/resolv.conf:
  55. file.managed:
  56. - source: salt://network/resolv.conf
  57. - template: jinja