Bechtoldt's Network Saltstack Formula
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

34 Zeilen
1.4KB

  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. resolver:
  5. file:
  6. - managed
  7. - name: {{ datamap.resolver.path|default('/etc/resolv.conf') }}
  8. - mode: {{ datamap.resolver.mode|default(644) }}
  9. - user: {{ datamap.resolver.user|default('root') }}
  10. - group: {{ datamap.resolver.group|default('root') }}
  11. - contents: |
  12. {%- if salt['pillar.get']('network:resolver:file_prepend', False) %}
  13. {{ salt['pillar.get']('network:resolver:file_prepend') }}
  14. {%- endif -%}
  15. {% if salt['pillar.get']('network:resolver:domain', False) %}
  16. domain {{ salt['pillar.get']('network:resolver:domain') }}
  17. {%- endif -%}
  18. {%- if salt['pillar.get']('network:resolver:search', False) %}
  19. search {{ salt['pillar.get']('network:resolver:search')|join(' ') }}
  20. {%- endif -%}
  21. {%- if salt['pillar.get']('network:resolver:nameservers', False) -%}
  22. {%- for n in salt['pillar.get']('network:resolver:nameservers') %}
  23. nameserver {{ n }}
  24. {%- endfor -%}
  25. {%- endif -%}
  26. {%- if salt['pillar.get']('network:resolver:options', False) %}
  27. options {{ salt['pillar.get']('network:resolver:options')|sort|join(' ') }}
  28. {%- endif -%}
  29. {%- if salt['pillar.get']('network:resolver:file_append', False) %}
  30. {{ salt['pillar.get']('network:resolver:file_append') }}
  31. {%- endif %}