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.

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']['values']['path'] }}
  7. - mode: 644
  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')|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 %}