Skip to content

Instantly share code, notes, and snippets.

Created October 9, 2015 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c1716ef25773bcdcdd25 to your computer and use it in GitHub Desktop.
Save anonymous/c1716ef25773bcdcdd25 to your computer and use it in GitHub Desktop.
cat selections/resolver/init.sls
/etc/resolv.conf:
file.managed:
- user: root
- group: root
- mode: '0644'
- source: salt://selections/resolver/files/resolv.conf
- template: jinja
- defaults:
{% if salt['grains.get']('domain') == 'chi1' or salt['grains.get']('domain') == 'aur1' %}
nameservers: {{ salt['pillar.get']('resolver:nameservers', ['172.16.200.181','172.16.208.81']) }}
{% else %}
nameservers: {{ salt['pillar.get']('resolver:nameservers', ['172.16.208.81','172.16.200.181']) }}
{% endif %}
searchpaths: {{ salt['pillar.get']('resolver:searchpaths', [salt['grains.get']('domain'),]) }}
options: {{ salt['pillar.get']('resolver:options', []) }}
$ cat selections/resolver/files/resolv.conf
{%- if searchpaths -%}
domain veliosystems.com
search {% for searchpath in searchpaths %}{{ searchpath }}.example.com {% endfor %}example.com
{%- endif %}
{%- for nameserver in nameservers %}
nameserver {{ nameserver }}
{%- endfor %}
options ndots:2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment