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']['path'] }}
  7. - mode: '0644'
  8. - user: root
  9. - group: root
  10. - contents: |
  11. {%- if salt['pillar.get']('network:resolver:file_prepend') is defined %}
  12. {{ salt['pillar.get']('network:resolver:file_prepend') }}
  13. {%- endif -%}
  14. {% if salt['pillar.get']('network:resolver:domain') is defined %}
  15. domain: {{ salt['pillar.get']('network:resolver:domain') }}
  16. {%- endif -%}
  17. {%- if salt['pillar.get']('network:resolver:search') is defined %}
  18. search: {{ salt['pillar.get']('network:resolver:search') }}
  19. {%- endif -%}
  20. {%- if salt['pillar.get']('network:resolver:nameservers') is defined -%}
  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') is defined %}
  26. options: {{ salt['pillar.get']('network:resolver:options')|join(' ') }}
  27. {%- endif -%}
  28. {%- if salt['pillar.get']('network:resolver:file_append') is defined %}
  29. {{ salt['pillar.get']('network:resolver:file_append') }}
  30. {%- endif %}