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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
Puppet::Type.newtype(:dns_zone) do
# zone_name = $name
# path = /var/named
# file = "${path}/dynamic/db.${zone_name}"
# purge = false
# ensurable
@doc = %q{
Manage the zonefile /var/named/dynamic/db.${zone}, and its records.
The zone can still be edited by hand, but invalid record might cause
puppet to do interesting things. Note that records directly on the
zone MUST have @ as key (instead of blank).
Existing $TTL directives in the zone are kept, but there is no way
to set it through this library (due to limitations in the zonefile
library).
}
newproperty(:ensure) do
desc "Ensurable"
# newvalues(:present, :absent)
newvalue(:present, :invalidate_refreshes => true) do
provider.create
end
newvalue(:absent) do
provider.destroy
end
defaultto :present
aliasvalue(:true, :present)
aliasvalue(:false, :absent)
def retrieve
if provider.exists?
:present
else
:absent
end
end
def set(value)
if value == :present
provider.create
else
provider.destroy
end
end
end
def refresh
provider.create
end
newparam(:purge) do
desc "Should all existing records be purged?"
end
newparam(:zone, :namevar => true) do
end
newparam(:ns_ttl) do
desc "TTL for NS records"
defaultto '1w'
end
newproperty(:ns, :array_matching => :all) do
desc "Nameservers for this zone"
isrequired
end
newproperty(:primary) do
desc "Primary nameserver for this zone"
isrequired
end
newproperty(:email) do
desc "Email to the zone administrator"
isrequired
end
newproperty(:soa_refresh) do
desc "SOA refresh, number of seconds after which secondary name servers should query the master for the SOA record"
defaultto '24h'
end
newproperty(:retry) do
desc "SOA retry, number of seconds after which seconday name servers should retry to requeth the serial from the master, must be less than refresh"
defaultto '2h'
end
newproperty(:expire) do
desc "SOA expire, Number of seconds secondary servers should continue answer queries for this zone if the master dissapears"
defaultto '1000h'
end
newproperty(:negative_ttl) do
desc "SOA negative_ttl, how long can clients cache a negative response"
defaultto '2d'
end
end
|