summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-06-06 21:41:12 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-06-10 19:18:54 +0200
commit3c3afcfb580fa7c3e43412df8bd07b1f60c94ce2 (patch)
tree50b8659b6ebbc9aaa83d2420453ebfaa4d7a7245
parentTransmission ADD trailing slashes. (diff)
downloadprofiles-3c3afcfb580fa7c3e43412df8bd07b1f60c94ce2.tar.gz
profiles-3c3afcfb580fa7c3e43412df8bd07b1f60c94ce2.tar.xz
Change to new DNS module.
-rw-r--r--manifests/dns.pp10
-rw-r--r--manifests/dns_zones.pp56
-rw-r--r--manifests/publish_dns.pp11
3 files changed, 15 insertions, 62 deletions
diff --git a/manifests/dns.pp b/manifests/dns.pp
new file mode 100644
index 0000000..bd24bde
--- /dev/null
+++ b/manifests/dns.pp
@@ -0,0 +1,10 @@
+# Simple profile for testing DNS module
+class profiles::dns (
+ Array[String] $realized_zones = [],
+) {
+ include ::dns
+
+ $realized_zones.each |$zone| {
+ Dns::Record <<| zone == $zone |>>
+ }
+}
diff --git a/manifests/dns_zones.pp b/manifests/dns_zones.pp
deleted file mode 100644
index eea3dd6..0000000
--- a/manifests/dns_zones.pp
+++ /dev/null
@@ -1,56 +0,0 @@
-# Sets up our dns-server, assumes that all zone information comes from
-# hiera.
-class profiles::dns_zones (
- Hash $zones,
- Hash $default = {},
- Optional[Hash] $views = undef,
- Hash $view_defaults = {},
- String $default_view = '_GLOBAL_',
- Hash $zonedata_default = {},
- Hash[String,Hash] $zonedata = {},
- Hash[String,Array[Hash]] $records = {},
-) {
-
- if $views != undef {
- class { 'dns':
- enable_views => true,
- }
- create_resources(dns::view, $views, $view_defaults)
- } else {
- include ::dns
- }
-
- create_resources(dns::zone, $zones, $default)
-
- create_resources(dns_zone, $zonedata, $zonedata_default)
-
- $zonedata.each |$zone, $_| {
- Dns_record <<| zone == $zone |>>
-
- # This breaks if views are used
- # "rndc reload $zone IN $view" works, but then we have too loop
- # somehow
- exec { "reload ${zone}":
- command => ['rndc' ,'reload', $zone],
- path => ['/usr/bin', '/usr/sbin'],
- refreshonly => true,
- subscribe => Dns_zone[$zone],
- }
- }
-
- $records.each |$zone, $record_entries| {
- $zone_hash = $record_entries.map |$d| {
- $type = $d['type']
- $key = $d['key']
- $value = $d['value']
- ["${zone} ${type} ${key} ${value}", $d]
- }
-
- create_resources(dns_record, Hash($zone_hash), {
- 'zone' => $zone,
- })
-
- }
-
-
-}
diff --git a/manifests/publish_dns.pp b/manifests/publish_dns.pp
index df10854..f88292f 100644
--- a/manifests/publish_dns.pp
+++ b/manifests/publish_dns.pp
@@ -2,22 +2,21 @@ class profiles::publish_dns (
) {
if fact('ipaddress6') {
-
- @@dns_record { "AAAA automatic ${::fqdn}":
+ @@dns::record { "AAAA automatic ${::fqdn}":
type => 'AAAA',
- zone => $facts['domain'],
+ zone => "${$facts['domain']}.",
key => $facts['hostname'],
value => $facts['ipaddress6'],
}
- [$record, $zone] = dns_record::rev_record(
+ [$record, $zone] = dns::rev_record(
$facts['networking']['ip6'],
$facts['networking']['netmask6'])
- @@dns_record { "PTR automatic ${::fqdn}":
+ @@dns::record { "PTR automatic ${::fqdn}":
type => 'PTR',
- zone => $zone,
+ zone => "${zone}.",
key => $record,
value => "${::fqdn}.",
}