Bechtoldt's Network Saltstack Formula
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

33 lines
1.2KB

  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: 644
  9. - user: 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')|join(' ') }}
  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')|sort|join(' ') }}
  27. {%- endif -%}
  28. {%- if salt['pillar.get']('network:resolver:file_append', False) %}
  29. {{ salt['pillar.get']('network:resolver:file_append') }}
  30. {%- endif %}