Bechtoldt's Network Saltstack Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 satır
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['interfaces']['def_entries'] %}
  4. {%- macro set_p(paramname, dictvar) -%}
  5. {%- if paramname in dictvar -%}
  6. - {{ paramname }}: {{ dictvar[paramname] }}
  7. {%- endif -%}
  8. {%- endmacro -%}
  9. {% if salt['pillar.get']('network:interfaces', False) %}
  10. {% set interfaces = interfaces + salt['pillar.get']('network:interfaces') %}
  11. {% endif %}
  12. {% for n in interfaces %}
  13. network-{{ n['name'] }}:
  14. network:
  15. - managed
  16. - name: {{ n['name'] }}
  17. - enabled: {{ n['enabled']|default(datamap['interfaces']['values']['enabled']) }}
  18. - proto: {{ n['proto']|default(datamap['interfaces']['values']['proto']) }}
  19. - type: {{ n['type']|default(datamap['interfaces']['values']['type']) }}
  20. {% for p in datamap['interfaces']['params_supported'] %}
  21. {{ set_p(p, n) }}
  22. {% endfor %}
  23. {% if n['use'] is defined %}
  24. - use:
  25. {% for u in n['use'] %}
  26. - network: network-{{ u }}
  27. {% endfor %}
  28. {% endif %}
  29. {% endfor %}