summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/base.pp19
-rw-r--r--manifests/init.pp3
-rw-r--r--manifests/mx.pp6
-rw-r--r--manifests/record.pp4
-rw-r--r--manifests/zone.pp38
5 files changed, 44 insertions, 26 deletions
diff --git a/manifests/base.pp b/manifests/base.pp
index c442085..752ed58 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -8,6 +8,15 @@ Please refer to Class["bind"].
*/
class bind::base {
+
+ include concat::setup
+
+ concat {'/etc/bind/named.conf.local':
+ owner => root,
+ group => root,
+ mode => '0644',
+ }
+
package {"bind9":
ensure => present,
}
@@ -18,11 +27,11 @@ class bind::base {
require => Package["bind9"],
}
- file {["/etc/bind/pri", "/etc/bind/zones"]:
- ensure => directory,
- owner => root,
- group => root,
- mode => 0755,
+ file {'/etc/bind/zones':
+ ensure => directory,
+ owner => root,
+ group => root,
+ mode => 0755,
require => Package["bind9"],
purge => true,
force => true,
diff --git a/manifests/init.pp b/manifests/init.pp
index d9af708..f81874a 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -3,9 +3,6 @@
= Class: bind
Include this class to install bind9 server on your node.
-Requires:
-- module common (git://github.com/camptocamp/puppet-common.git)
-
Bind documentation:
http://www.bind9.net/manuals
diff --git a/manifests/mx.pp b/manifests/mx.pp
index 84a2b9f..433c8ea 100644
--- a/manifests/mx.pp
+++ b/manifests/mx.pp
@@ -24,11 +24,11 @@ define bind::mx($ensure=present,
$_owner = $name
}
- common::concatfilepart{"bind.${name}":
- file => "/etc/bind/pri/${zone}",
+ concat::fragment {"bind.${name}":
ensure => $ensure,
- notify => Service["bind9"],
+ target => "/etc/bind/pri/${zone}.conf",
content => template("bind/mx-record.erb"),
+ notify => Service["bind9"],
require => [Bind::Zone[$zone], Bind::A[$host]],
}
}
diff --git a/manifests/record.pp b/manifests/record.pp
index d551d60..ef53833 100644
--- a/manifests/record.pp
+++ b/manifests/record.pp
@@ -26,9 +26,9 @@ define bind::record($ensure=present,
$_owner = $name
}
- common::concatfilepart {"${zone}.${record_type}.${name}":
+ concat::fragment {"${zone}.${record_type}.${name}":
ensure => $ensure,
- file => "/etc/bind/pri/${zone}.conf",
+ target => "/etc/bind/pri/${zone}.conf",
content => template("bind/default-record.erb"),
notify => Service["bind9"],
}
diff --git a/manifests/zone.pp b/manifests/zone.pp
index 62df7fc..6829569 100644
--- a/manifests/zone.pp
+++ b/manifests/zone.pp
@@ -29,19 +29,31 @@ define bind::zone($ensure=present,
$zone_xfers=false,
$zone_masters=false,
$zone_origin=false) {
+
+ concat {"/etc/bind/pri/${name}.conf":
+ owner => root,
+ group => root,
+ mode => '0644',
+ }
+
+ concat {"/etc/bind/zones/${name}.conf":
+ owner => root,
+ group => root,
+ mode => '0644',
+ }
- common::concatfilepart {"bind.zones.${name}":
+ concat::fragment {"bind.zones.${name}":
ensure => $ensure,
+ target => "/etc/bind/zones/${name}.conf",
notify => Service["bind9"],
- file => "/etc/bind/zones/${name}.conf",
require => Package["bind9"],
}
- common::concatfilepart {"named.local.zone.${name}":
+ concat::fragment {"named.local.zone.${name}":
ensure => $ensure,
- notify => Service["bind9"],
- file => "/etc/bind/named.conf.local",
+ target => "/etc/bind/named.conf.local",
content => "include \"/etc/bind/zones/${name}.conf\";\n",
+ notify => Service["bind9"],
require => Package["bind9"],
}
@@ -49,7 +61,7 @@ define bind::zone($ensure=present,
if !$zone_masters {
fail "No master defined for ${name}!"
}
- Common::Concatfilepart["bind.zones.${name}"] {
+ Concat::Fragment["bind.zones.${name}"] {
content => template("bind/zone-slave.erb"),
}
## END of slave
@@ -67,21 +79,21 @@ define bind::zone($ensure=present,
fail "No ttl defined for ${name}!"
}
- Common::Concatfilepart["bind.zones.${name}"] {
+ Concat::Fragment["bind.zones.${name}"] {
content => template("bind/zone-master.erb"),
}
- common::concatfilepart {"00.bind.${name}":
- ensure => $ensure,
- file => "/etc/bind/pri/${name}.conf",
+ concat::fragment {"00.bind.${name}":
+ ensure => $ensure,
+ target => "/etc/bind/pri/${name}.conf",
content => template("bind/zone-header.erb"),
require => Package["bind9"],
}
file {"/etc/bind/pri/${name}.conf.d":
- ensure => directory,
- mode => 0700,
- purge => true,
+ ensure => absent,
+ mode => 0700,
+ purge => true,
recurse => true,
backup => false,
force => true,