Bechtoldt's Network Saltstack Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

33 lines
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['defaults']['enabled']) }}
  13. - proto: {{ n['proto']|default(datamap['defaults']['proto']) }}
  14. - type: {{ n['type']|default(datamap['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 %}