Bechtoldt's Network Saltstack Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

33 Zeilen
1.1KB

  1. {% from "network/defaults.yaml" import rawmap with context %}
  2. {% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network:lookup')) %}
  3. {% set interfaces = datamap['default_interfaces'] %}
  4. {% if salt['pillar.get']('network:interfaces') is defined %}
  5. {% set interfaces = interfaces + salt['pillar.get']('network:interfaces') %}
  6. {% endif %}
  7. {% for n in interfaces %}
  8. network-{{ n['name'] }}:
  9. network:
  10. - managed
  11. - name: {{ n['name'] }}
  12. - enabled: {{ n['enabled']|default(datamap['interface_defaults']['enabled']) }}
  13. - proto: {{ n['proto']|default(datamap['interface_defaults']['proto']) }}
  14. - type: {{ n['type']|default(datamap['interface_defaults']['type']) }}
  15. {% if n['proto'] in ['static'] %}
  16. {% if n['ipaddr'] is defined %}
  17. - ipaddr: {{ n['ipaddr'] }}
  18. {% endif %}
  19. {% if n['gateway'] is defined %}
  20. - gateway: {{ n['gateway'] }}
  21. {% endif %}
  22. {% if n['netmask'] is defined %}
  23. - netmask: {{ n['netmask'] }}
  24. {% endif %}
  25. {% if n['broadcast'] is defined %}
  26. - broadcast: {{ n['broadcast'] }}
  27. {% endif %}
  28. {% endif %}
  29. {% endfor %}