Bechtoldt's Network Saltstack Formula
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

32 lines
1.2KB

  1. {% from "network/defaults.yaml" import rawmap with context %}
  2. {% set datamap = salt['grains.filter_by'](rawmap, merge=salt['pillar.get']('network:lookup')) %}
  3. resolver:
  4. file:
  5. - managed
  6. - name: {{ datamap['resolver']['path'] }}
  7. - mode: '0644'
  8. - user: root
  9. - group: root
  10. - contents: |
  11. {%- if salt['pillar.get']('network:resolver:file_prepend', False) %}
  12. {{ salt['pillar.get']('network:resolver:file_prepend') }}
  13. {%- endif -%}
  14. {% if salt['pillar.get']('network:resolver:domain', False) %}
  15. domain: {{ salt['pillar.get']('network:resolver:domain') }}
  16. {%- endif -%}
  17. {%- if salt['pillar.get']('network:resolver:search', False) %}
  18. search: {{ salt['pillar.get']('network:resolver:search') }}
  19. {%- endif -%}
  20. {%- if salt['pillar.get']('network:resolver:nameservers', False) -%}
  21. {%- for n in salt['pillar.get']('network:resolver:nameservers') %}
  22. nameserver: {{ n }}
  23. {%- endfor -%}
  24. {%- endif -%}
  25. {%- if salt['pillar.get']('network:resolver:options', False) %}
  26. options: {{ salt['pillar.get']('network:resolver:options')|join(' ') }}
  27. {%- endif -%}
  28. {%- if salt['pillar.get']('network:resolver:file_append', False) %}
  29. {{ salt['pillar.get']('network:resolver:file_append') }}
  30. {%- endif %}