summaryrefslogtreecommitdiff
path: root/manifests/definitions/bind-zone.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/definitions/bind-zone.pp')
-rw-r--r--manifests/definitions/bind-zone.pp58
1 files changed, 58 insertions, 0 deletions
diff --git a/manifests/definitions/bind-zone.pp b/manifests/definitions/bind-zone.pp
new file mode 100644
index 0000000..137bcd8
--- /dev/null
+++ b/manifests/definitions/bind-zone.pp
@@ -0,0 +1,58 @@
+define bind::zone($ensure=present,
+ $is_slave=false,
+ $zone_ttl=false,
+ $zone_contact=false,
+ $zone_serial=false,
+ $zone_refresh="3h",
+ $zone_retry="1h",
+ $zone_expiracy="1w",
+ $zone_ns=false,
+ $zone_xfers=false,
+ $zone_masters=false) {
+
+ common::concatfilepart {"bind.zones.${name}":
+ ensure => $ensure,
+ notify => Service["bind9"],
+ file => "/etc/bind/zones/${name}.conf",
+ }
+
+ common::concatfilepart {"named.local.zone.${name}":
+ ensure => $ensure,
+ notify => Service["bind9"],
+ file => "/etc/bind/named.conf.local",
+ content => "include \"/etc/bind/zones/${name}.conf\";\n",
+ }
+
+ if $is_slave {
+ if !$zone_masters {
+ fail "No master defined for ${name}!"
+ }
+ Common::Concatfilepart["bind.zones.${name}"] {
+ content => template("bind/zone-slave.erb"),
+ }
+## END of slave
+ } else {
+ if !$zone_contact {
+ fail "No contact defined for ${name}!"
+ }
+ if !$zone_ns {
+ fail "No ns defined for ${name}!"
+ }
+ if !$zone_serial {
+ fail "No serial defined for ${name}!"
+ }
+ if !$zone_ttl {
+ fail "No ttl defined for ${name}!"
+ }
+
+ Common::Concatfilepart["bind.zones.${name}"] {
+ content => template("bind/zone-master.erb"),
+ }
+
+ common::concatfilepart {"bind.00.${name}":
+ ensure => $ensure,
+ file => "/etc/bind/pri/${name}.conf",
+ content => template("bind/zone-header.erb"),
+ }
+ }
+}