Skip to content

Commit 05afb07

Browse files
authored
Merge pull request #371 from ekohl/dns-stub-listener-extra
Implement DNSStubListenerExtra for resolved.conf
2 parents 006bdf0 + 636cf77 commit 05afb07

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

REFERENCE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ The following parameters are available in the `systemd` class:
9797
* [`dnsovertls`](#-systemd--dnsovertls)
9898
* [`cache`](#-systemd--cache)
9999
* [`dns_stub_listener`](#-systemd--dns_stub_listener)
100+
* [`dns_stub_listener_extra`](#-systemd--dns_stub_listener_extra)
100101
* [`manage_resolv_conf`](#-systemd--manage_resolv_conf)
101102
* [`use_stub_resolver`](#-systemd--use_stub_resolver)
102103
* [`manage_networkd`](#-systemd--manage_networkd)
@@ -287,6 +288,14 @@ Takes a boolean argument or one of "udp" and "tcp".
287288

288289
Default value: `undef`
289290

291+
##### <a name="-systemd--dns_stub_listener_extra"></a>`dns_stub_listener_extra`
292+
293+
Data type: `Optional[Array[String[1]]]`
294+
295+
Additional addresses for the DNS stub listener to listen on
296+
297+
Default value: `undef`
298+
290299
##### <a name="-systemd--manage_resolv_conf"></a>`manage_resolv_conf`
291300

292301
Data type: `Boolean`

manifests/init.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
# @param dns_stub_listener
6767
# Takes a boolean argument or one of "udp" and "tcp".
6868
#
69+
# @param dns_stub_listener_extra
70+
# Additional addresses for the DNS stub listener to listen on
71+
#
6972
# @param manage_resolv_conf
7073
# For when `manage_resolved` is `true` should the file `/etc/resolv.conf` be managed.
7174
#
@@ -197,6 +200,7 @@
197200
Variant[Boolean,Enum['yes', 'opportunistic', 'no']] $dnsovertls = false,
198201
Variant[Boolean,Enum['no-negative']] $cache = false,
199202
Optional[Variant[Boolean,Enum['udp','tcp']]] $dns_stub_listener = undef,
203+
Optional[Array[String[1]]] $dns_stub_listener_extra = undef,
200204
Boolean $manage_resolv_conf = true,
201205
Boolean $use_stub_resolver = false,
202206
Boolean $manage_networkd = false,

manifests/resolved.pp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
# @param dns_stub_listener
4242
# Takes a boolean argument or one of "udp" and "tcp".
4343
#
44+
# @param dns_stub_listener_extra
45+
# Additional addresses for the DNS stub listener to listen on
46+
#
4447
# @param use_stub_resolver
4548
# Takes a boolean argument. When "false" (default) it uses /run/systemd/resolve/resolv.conf
4649
# as /etc/resolv.conf. When "true", it uses /run/systemd/resolve/stub-resolv.conf
@@ -56,6 +59,7 @@
5659
Optional[Variant[Boolean,Enum['yes', 'opportunistic', 'no']]] $dnsovertls = $systemd::dnsovertls,
5760
Optional[Variant[Boolean,Enum['no-negative']]] $cache = $systemd::cache,
5861
Optional[Variant[Boolean,Enum['udp', 'tcp']]] $dns_stub_listener = $systemd::dns_stub_listener,
62+
Optional[Array[String[1]]] $dns_stub_listener_extra = $systemd::dns_stub_listener_extra,
5963
Boolean $use_stub_resolver = $systemd::use_stub_resolver,
6064
) {
6165
assert_private()
@@ -245,4 +249,15 @@
245249
notify => Service['systemd-resolved'],
246250
}
247251
}
252+
253+
if $dns_stub_listener_extra {
254+
ini_setting { 'dns_stub_listener_extra':
255+
ensure => 'present',
256+
value => $dns_stub_listener_extra,
257+
setting => 'DNSStubListenerExtra',
258+
section => 'Resolve',
259+
path => '/etc/systemd/resolved.conf',
260+
notify => Service['systemd-resolved'],
261+
}
262+
}
248263
}

spec/classes/init_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
dnsovertls: 'no',
144144
cache: true,
145145
dns_stub_listener: 'udp',
146+
dns_stub_listener_extra: ['192.0.2.1', '2001:db8::1'],
146147
}
147148
end
148149

@@ -164,6 +165,7 @@
164165
}
165166

166167
it { is_expected.to contain_ini_setting('dns_stub_listener') }
168+
it { is_expected.to contain_ini_setting('dns_stub_listener_extra').with_value(['192.0.2.1', '2001:db8::1']) }
167169
end
168170

169171
context 'when enabling resolved with no-negative cache variant' do

0 commit comments

Comments
 (0)