From 46284e3bf775d933cc1d5b09d064d1bb71a68e5e Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme <jan.philipp@timme.it> Date: Tue, 3 Dec 2019 18:22:55 +0100 Subject: [PATCH] Manage /etc/resolv.conf properly with defaults.yaml --- hshbase/defaults.yaml | 3 +++ hshbase/init.sls | 1 + hshbase/resolvconf/files/resolv.conf | 6 ++++++ hshbase/resolvconf/init.sls | 5 +++++ 4 files changed, 15 insertions(+) create mode 100644 hshbase/resolvconf/files/resolv.conf create mode 100644 hshbase/resolvconf/init.sls diff --git a/hshbase/defaults.yaml b/hshbase/defaults.yaml index 12acb97..f8fa2c2 100644 --- a/hshbase/defaults.yaml +++ b/hshbase/defaults.yaml @@ -11,3 +11,6 @@ hshbase: system: en_US.UTF-8 present: - de_DE.UTF-8 + dns: + - 192.108.52.10 + - 141.71.2.121 diff --git a/hshbase/init.sls b/hshbase/init.sls index 06815f1..7613e7f 100644 --- a/hshbase/init.sls +++ b/hshbase/init.sls @@ -9,3 +9,4 @@ include: - .time - .locale - .hostname + - .resolvconf diff --git a/hshbase/resolvconf/files/resolv.conf b/hshbase/resolvconf/files/resolv.conf new file mode 100644 index 0000000..df4cb92 --- /dev/null +++ b/hshbase/resolvconf/files/resolv.conf @@ -0,0 +1,6 @@ +{%- from "hshbase/map.jinja" import hshbase with context-%} +### THIS FILE IS MANAGED BY SALT! +### YOUR CHANGES WILL BE OVERWRITTEN! +{% for resolver in hshbase['dns'] -%} +nameserver {{ resolver }} +{% endfor %} diff --git a/hshbase/resolvconf/init.sls b/hshbase/resolvconf/init.sls new file mode 100644 index 0000000..21da43a --- /dev/null +++ b/hshbase/resolvconf/init.sls @@ -0,0 +1,5 @@ +hshbase_resolvconf_file: + file.managed: + - name: /etc/resolv.conf + - template: jinja + - source: salt://hshbase/resolvconf/files/resolv.conf -- GitLab