Browse Source

Allow setting resolv.conf

tags/2016.12
Filip Pytloun 9 years ago
parent
commit
de9bea5af5
4 changed files with 42 additions and 0 deletions
  1. +15
    -0
      README.rst
  2. +14
    -0
      linux/files/resolv.conf
  3. +3
    -0
      linux/network/init.sls
  4. +10
    -0
      linux/network/resolv.sls

+ 15
- 0
README.rst View File

@@ -378,6 +378,21 @@ Linux with hosts
- node2.domain.com
- service2.domain.com

Setup resolv.conf, nameservers, domain and search domains

.. code-block:: yaml

linux:
network:
resolv:
dns:
- 8.8.4.4
- 8.8.8.8
domain: my.example.com
search:
- my.example.com
- example.com

Linux storage pillars
---------------------


+ 14
- 0
linux/files/resolv.conf View File

@@ -0,0 +1,14 @@
{%- from "linux/map.jinja" import network with context %}# Dynamic resolv.conf(5) file for glibc resolver(3) generated by salt-minion(1)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
{% if network.resolv.search -%}
search {{ network.resolv.search|join(' ') }}
{%- endif %}
{% if network.resolv.domain -%}
domain {{ network.resolv.domain }}
{%- endif %}
{%- for nameserver in network.resolv.dns %}
nameserver {{ nameserver }}
{%- endfor %}
{%- if network.resolv.options %}
options {{ options|sort|join(' ') }}
{%- endif %}

+ 3
- 0
linux/network/init.sls View File

@@ -4,6 +4,9 @@ include:
{%- if network.host|length > 0 %}
- linux.network.host
{%- endif %}
{%- if network.resolv is defined %}
- linux.network.resolv
{%- endif %}
{%- if network.interface|length > 0 %}
- linux.network.interface
{%- endif %}

+ 10
- 0
linux/network/resolv.sls View File

@@ -0,0 +1,10 @@
{%- from "linux/map.jinja" import network with context %}
{%- if network.enabled %}

/etc/resolv.conf:
file.managed:
- source: salt://linux/files/resolv.conf
- mode: 644
- template: jinja

{%- endif %}

Loading…
Cancel
Save