Revision 63902e07
Added by Trey Dockendorf about 9 years ago
manifests/zone.pp | ||
---|---|---|
# Define new zone for the dns
|
||
define dns::zone (
|
||
$zonetype='master',
|
||
$soa='',
|
||
$reverse=false,
|
||
$ttl='10800',
|
||
$soaip='',
|
||
$zonetype = 'master',
|
||
$soa = $::fqdn,
|
||
$reverse = false,
|
||
$ttl = '10800',
|
||
$soaip = $::ipaddress,
|
||
$refresh = 86400,
|
||
$update_retry = 3600,
|
||
$expire = 604800,
|
||
$negttl = 3600,
|
||
$zonefilepath = $dns::params::zonefilepath,
|
||
$namedservicename = $dns::params::namedservicename,
|
||
$serial = 1,
|
||
$masters = [],
|
||
$allow_transfer = []
|
||
$allow_transfer = [],
|
||
$zone = $title,
|
||
$contact = "root.${title}.",
|
||
$filename = "db.${title}",
|
||
) {
|
||
$contact = "root.${name}."
|
||
$serial = 1
|
||
|
||
if ! defined(Class[dns]) {
|
||
class { 'dns':
|
||
zonefilepath => $zonefilepath,
|
||
namedservicename => $namedservicename
|
||
}
|
||
validate_bool($reverse)
|
||
validate_array($masters, $allow_transfer)
|
||
|
||
# Validate that the value for soa is within the zone
|
||
$soa_parts = split($soa, '[.]')
|
||
$soa_hostname = $soa_parts[0]
|
||
if $soa != "${soa_hostname}.${zone}" and ! $reverse {
|
||
fail('soa must be within the defined zone.')
|
||
}
|
||
|
||
include dns::params
|
||
include dns
|
||
|
||
$zone = $name
|
||
$filename = "db.${zone}"
|
||
$zonefilename = "${zonefilepath}/${filename}"
|
||
$zonefilename = "${dns::zonefilepath}/${filename}"
|
||
|
||
concat_fragment { "dns_zones+10_${zone}.dns":
|
||
content => template('dns/named.zone.erb'),
|
||
}
|
||
|
||
file { $zonefilename:
|
||
owner => $dns::params::user,
|
||
group => $dns::params::group,
|
||
mode => '0640',
|
||
owner => $dns::user,
|
||
group => $dns::group,
|
||
mode => '0644',
|
||
content => template('dns/zone.header.erb'),
|
||
require => File[$zonefilepath],
|
||
replace => false,
|
||
notify => Service[$namedservicename],
|
||
notify => Service[$dns::namedservicename],
|
||
}
|
||
}
|
Also available in: Unified diff
Add support for master-slave configuration
Initial work came from PR #24. This varies from that pull request in the following ways
Additionally changes to dns::zone to move variables to parameters and include sane default values