1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# @param type
# Record type (A, AAAA, ...)
# @param class
# DNS class type (IN, HS, CH, HS)
# @param dns_name
# Name of record (example.com.)
# Note that the trailing period **IS** significant
# @param ttl
# TTL for record.
# @param duplicate
# Allow multiple records with the same name and class.
# Most record types only allow one value, but some allow multiple.
# Setting this to true allows for multiple. This value is
# automatically true for TXT & NS.
# @param zone
# Name of the zone this record belongs to.
# @param value
# Record content.
# Syntax depends on `type`.
define dns::record (
String $zone,
Dns::Rr $type,
String $value,
Dns::Class $class = 'IN',
String $dns_name = $name,
Optional[Dns::Ttl] $ttl = undef,
Boolean $duplicate = false,
) {
$allow_duplicate = case $type {
'TXT',
'NS': {
true
}
default: {
false
}
}
$frag_name = if $allow_duplicate {
"Dns::Record - ${zone} - ${class} ${type} ${dns_name} ${value}"
} else {
"Dns::Record - ${zone} - ${class} ${type} ${dns_name}"
}
concat::fragment { $frag_name:
target => "${dns::zone_directory}/${zone}.db",
}
}
|