Bechtoldt's Network Saltstack Formula
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

interfaces.sls 1.0KB

1234567891011121314151617181920212223242526272829
  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. {% if salt['pillar.get']('network:interfaces', False) %}
  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['interfaces']['values']['enabled']) }}
  13. - proto: {{ n['proto']|default(datamap['interfaces']['values']['proto']) }}
  14. - type: {{ n['type']|default(datamap['interfaces']['values']['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. {% endif %}
  26. {% endfor %}