Bechtoldt's Network Saltstack Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

36 rindas
1.1KB

  1. #!jinja|yaml
  2. {% from "network/defaults.yaml" import rawmap with context %}
  3. {% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network:lookup')) %}
  4. {% set interfaces = datamap.interfaces.def_entries %}
  5. {%- macro set_p(paramname, dictvar) -%}
  6. {%- if paramname in dictvar -%}
  7. - {{ paramname }}: {{ dictvar[paramname] }}
  8. {%- endif -%}
  9. {%- endmacro -%}
  10. {% if salt['pillar.get']('network:interfaces', False) %}
  11. {% set interfaces = interfaces + salt['pillar.get']('network:interfaces') %}
  12. {% endif %}
  13. {% for n in interfaces %}
  14. network-{{ n.name }}:
  15. network:
  16. - managed
  17. - name: {{ n.name }}
  18. - enabled: {{ n.enable|default(datamap.interfaces.default_values.enable) }}
  19. - proto: {{ n.proto|default(datamap.interfaces.default_values.proto) }}
  20. - type: {{ n.type|default(datamap.interfaces.default_values.type) }}
  21. {% for p in datamap.interfaces.params_supported %}
  22. {{ set_p(p, n) }}
  23. {% endfor %}
  24. {% if n.use is defined %}
  25. - use:
  26. {% for u in n.use %}
  27. - network: network-{{ u }}
  28. {% endfor %}
  29. {% endif %}
  30. {% endfor %}