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.

24 lines
821B

  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')) %}
  4. {# TODO: The function name 'routes' in 'network.routes' should be moved into the list as soon as it's possible
  5. for code convention reasons. Unfortunately 'routes' is also used in **kwargs when calling ip.build_routes
  6. in salt.states.network #}
  7. {% for k, v in datamap.routes|default({})|dictsort %}
  8. routes_{{ v.name|default(k) }}:
  9. network.routes:
  10. - name: {{ v.name|default(k) }}
  11. - routes:
  12. {% for net in v.networks %}
  13. - name: {{ net.name }}
  14. ipaddr: {{ net.ipaddr }}
  15. netmask: {{ net.netmask }}
  16. {% if net.gateway is defined %}
  17. gateway: {{ net.gateway }}
  18. {% endif %}
  19. {% endfor %}
  20. {% endfor %}