From d713f54b45ab78f84953befa7c4851d8ddcf3cf0 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme <jan.philipp@timme.it> Date: Wed, 29 Dec 2021 10:45:59 +0100 Subject: [PATCH] Add simple state to enable and configure systemd-resolved --- .../files/etc/systemd/resolved.conf | 27 +++++++++++++++++++ hshbase/systemd-resolved/init.sls | 15 +++++++++++ 2 files changed, 42 insertions(+) create mode 100644 hshbase/systemd-resolved/files/etc/systemd/resolved.conf create mode 100644 hshbase/systemd-resolved/init.sls diff --git a/hshbase/systemd-resolved/files/etc/systemd/resolved.conf b/hshbase/systemd-resolved/files/etc/systemd/resolved.conf new file mode 100644 index 0000000..fb054d2 --- /dev/null +++ b/hshbase/systemd-resolved/files/etc/systemd/resolved.conf @@ -0,0 +1,27 @@ +### THIS FILE IS MANAGED BY SALT! +### YOUR CHANGES WILL BE OVERWRITTEN! + +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# Entries in this file show the compile time defaults. +# You can change settings by editing this file. +# Defaults can be restored by simply deleting this file. +# +# See resolved.conf(5) for details + +[Resolve] +DNS= {{ hshbase['dns']|join(',') }} +#FallbackDNS= +#Domains= +#LLMNR=yes +MulticastDNS=no +#DNSSEC=allow-downgrade +#DNSOverTLS=no +Cache=no +#DNSStubListener=yes +#ReadEtcHosts=yes diff --git a/hshbase/systemd-resolved/init.sls b/hshbase/systemd-resolved/init.sls new file mode 100644 index 0000000..5b6e73e --- /dev/null +++ b/hshbase/systemd-resolved/init.sls @@ -0,0 +1,15 @@ +hsh_manage_systemd_resolved_config: + file.managed: + - name: /etc/systemd/resolved.conf + - source: salt://hshbase/systemd-resolved/files/etc/systemd/resolved.conf + - template: jinja + +hsh_enable_and_restart_systemd_resolved: + service.running: + - name: systemd-resolved.service + - enable: True + - restart: True + - require: + - file: hsh_manage_systemd_resolved_config + - watch: + - file: hsh_manage_systemd_resolved_config -- GitLab