summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifests/a.pp52
-rw-r--r--manifests/aaaa.pp44
-rw-r--r--manifests/base.pp28
-rw-r--r--manifests/cname.pp45
-rw-r--r--manifests/debian.pp21
-rw-r--r--manifests/init.pp96
-rw-r--r--manifests/mx.pp42
-rw-r--r--manifests/ns.pp45
-rw-r--r--manifests/ptr.pp45
-rw-r--r--manifests/record.pp47
-rw-r--r--manifests/txt.pp45
-rw-r--r--manifests/zone.pp85
12 files changed, 301 insertions, 294 deletions
diff --git a/manifests/a.pp b/manifests/a.pp
index 41fdee8..d457413 100644
--- a/manifests/a.pp
+++ b/manifests/a.pp
@@ -1,34 +1,35 @@
-/*
-
-= Definition: bind::a
-Creates an IPv4 record.
-
-Arguments:
- *$zone*: Bind::Zone name
- *$owner*: owner of the Resource Record
- *$host*: target of the Resource Record
- *$ttl*: Time to Live for the Resource Record. Optional.
- *$ptr*: create the corresponding ptr record (default=false)
-
-*/
-define bind::a($ensure=present,
- $zone,
- $owner=false,
- $host,
- $ttl=false,
- $ptr=false) {
+# = Definition: bind::a
+#
+# Creates an IPv4 record.
+#
+# Arguments:
+# *$zone*: Bind::Zone name
+# *$owner*: owner of the Resource Record
+# *$host*: target of the Resource Record
+# *$ttl*: Time to Live for the Resource Record. Optional.
+# *$ptr*: create the corresponding ptr record (default=false)
+#
+#
+define bind::a(
+ $zone,
+ $host,
+ $ensure = present,
+ $owner = false,
+ $ttl = false,
+ $ptr = false
+) {
bind::record {$name:
- ensure => $ensure,
- zone => $zone,
- owner => $owner,
- host => $host,
- ttl => $ttl,
+ ensure => $ensure,
+ zone => $zone,
+ owner => $owner,
+ host => $host,
+ ttl => $ttl,
record_type => 'A',
}
if $ptr {
- $arpa = inline_template("<%= require 'ipaddr'; IPAddr.new(host).reverse %>")
+ $arpa = inline_template("<%= require 'ipaddr'; IPAddr.new(host).reverse %>")
$arpa_zone = inline_template("<%= require 'ipaddr'; IPAddr.new(host).reverse.split('.')[1..-1].join('.') %>")
bind::ptr {"${arpa}.":
@@ -38,4 +39,5 @@ define bind::a($ensure=present,
ttl => $ttl,
}
}
+
}
diff --git a/manifests/aaaa.pp b/manifests/aaaa.pp
index 80291c2..9466d0f 100644
--- a/manifests/aaaa.pp
+++ b/manifests/aaaa.pp
@@ -1,27 +1,27 @@
-/*
-
-= Definition: bind::aaaa
-Creates an IPv6 AAAA record.
-
-Arguments:
- *$zone*: Bind::Zone name
- *$owner*: owner of the Resource Record
- *$host*: target of the Resource Record
- *$ttl*: Time to Live for the Resource Record. Optional.
-
-*/
-define bind::aaaa($ensure=present,
- $zone,
- $owner=false,
- $host,
- $ttl=false) {
+# = Definition: bind::aaaa
+#
+# Creates an IPv6 AAAA record.
+#
+# Arguments:
+# *$zone*: Bind::Zone name
+# *$owner*: owner of the Resource Record
+# *$host*: target of the Resource Record
+# *$ttl*: Time to Live for the Resource Record. Optional.
+#
+define bind::aaaa (
+ $zone,
+ $host,
+ $ensure = present,
+ $owner = false,
+ $ttl = false
+) {
bind::record {$name:
- ensure => $ensure,
- zone => $zone,
- owner => $owner,
- host => $host,
- ttl => $ttl,
+ ensure => $ensure,
+ zone => $zone,
+ owner => $owner,
+ host => $host,
+ ttl => $ttl,
record_type => 'AAAA',
}
diff --git a/manifests/base.pp b/manifests/base.pp
index 752ed58..63eefbc 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -1,12 +1,9 @@
-/*
-
-= Class: bind::base
-
-Declares some basic resources.
-You should NOT include this class as is, as it won't work at all!
-Please refer to Class["bind"].
-
-*/
+# = Class: bind::base
+#
+# Declares some basic resources.
+# You should NOT include this class as is, as it won't work at all!
+# Please refer to Class['bind'].
+#
class bind::base {
include concat::setup
@@ -17,25 +14,26 @@ class bind::base {
mode => '0644',
}
- package {"bind9":
+ package {'bind9':
ensure => present,
}
- service {"bind9":
+ service {'bind9':
ensure => running,
enable => true,
- require => Package["bind9"],
+ require => Package['bind9'],
}
file {'/etc/bind/zones':
ensure => directory,
owner => root,
group => root,
- mode => 0755,
- require => Package["bind9"],
+ mode => '0755',
purge => true,
force => true,
recurse => true,
- source => "puppet:///modules/bind/empty",
+ source => 'puppet:///modules/bind/empty',
+ require => Package['bind9'],
}
+
}
diff --git a/manifests/cname.pp b/manifests/cname.pp
index c8baeec..f8eca40 100644
--- a/manifests/cname.pp
+++ b/manifests/cname.pp
@@ -1,27 +1,28 @@
-/*
-
-= Definition: bind::cname
-Creates a CNAME record.
-
-Arguments:
- *$zone*: Bind::Zone name
- *$owner*: owner of the Resource Record
- *$host*: target of the Resource Record
- *$ttl*: Time to Live for the Resource Record. Optional.
-
-*/
-define bind::cname($ensure=present,
- $zone,
- $owner=false,
- $host,
- $ttl=false) {
+# = Definition: bind::cname
+#
+# Creates a CNAME record.
+#
+# Arguments:
+# *$zone*: Bind::Zone name
+# *$owner*: owner of the Resource Record
+# *$host*: target of the Resource Record
+# *$ttl*: Time to Live for the Resource Record. Optional.
+#
+define bind::cname (
+ $zone,
+ $host,
+ $ensure = present,
+ $owner = false,
+ $ttl = false
+) {
bind::record {$name:
- ensure => $ensure,
- zone => $zone,
- owner => $owner,
- host => $host,
- ttl => $ttl,
+ ensure => $ensure,
+ zone => $zone,
+ owner => $owner,
+ host => $host,
+ ttl => $ttl,
record_type => 'CNAME',
}
+
}
diff --git a/manifests/debian.pp b/manifests/debian.pp
index 7b752ae..41e356e 100644
--- a/manifests/debian.pp
+++ b/manifests/debian.pp
@@ -1,14 +1,13 @@
-/*
-
-= Class: bind::debian
-Special debian class - inherits from bind::base
-
-You should not include this class - please refer to Class["bind"]
-
-*/
+# = Class: bind::debian
+# Special debian class - inherits from bind::base
+#
+# You should not include this class - please refer to Class["bind"]
+#
class bind::debian inherits bind::base {
- Service["bind9"] {
- pattern => "/usr/sbin/named",
- restart => "/etc/init.d/bind9 reload",
+
+ Service['bind9'] {
+ pattern => '/usr/sbin/named',
+ restart => '/etc/init.d/bind9 reload',
}
+
}
diff --git a/manifests/init.pp b/manifests/init.pp
index f81874a..ff88737 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,51 +1,53 @@
-/*
-
-= Class: bind
-Include this class to install bind9 server on your node.
-
-Bind documentation:
-http://www.bind9.net/manuals
-
-Limitations:
-This modules is valid for Bind 9.7.1 (squeeze version).
-For 9.7.2, it will be really limited (no view nor ACL support).
-
-
-Example:
-
-node "ns1.domain.ltd" {
- include bind
- bind::zone {"domain.ltd":
- ensure => present,
- zone_contact => "contact.domain.ltd",
- zone_ns => $fqdn,
- zone_serial => "2010110804",
- zone_ttl => "604800",
- }
-
- bind::a {"ns $fqdn":
- zone => "domain.ltd",
- owner => "${fqdn}.",
- host => $ipaddress,
- }
+# = Class: bind
+# Include this class to install bind9 server on your node.
+#
+# Bind documentation:
+# http://www.bind9.net/manuals
+#
+# Limitations:
+# This modules is valid for Bind 9.7.1 (squeeze version).
+# For 9.7.2, it will be really limited (no view nor ACL support).
+#
+#
+# Example:
+#
+# node 'ns1.domain.ltd' {
+#
+# include bind
+#
+# bind::zone {'domain.ltd':
+# ensure => present,
+# zone_contact => "contact.domain.ltd",
+# zone_ns => $fqdn,
+# zone_serial => '2010110804',
+# zone_ttl => '604800',
+# }
+#
+# bind::a {"ns $fqdn":
+# zone => 'domain.ltd',
+# owner => "${fqdn}.",
+# host => $ipaddress,
+# }
+#
+# bind::a {'mail.domain.ltd':
+# zone => 'domain.ltd',
+# owner => 'mail',
+# host => '6.6.6.6',
+# }
+#
+# bind::mx {'mx1':
+# zone => 'domain.ltd',
+# owner => '@',
+# priority => 1,
+# host => 'mail.domain.ltd',
+# }
+# }
+#
+class bind {
- bind::a {"mail.domain.ltd":
- zone => "domain.ltd",
- owner => "mail",
- host => "6.6.6.6",
+ case $::operatingsystem {
+ 'Debian','Ubuntu': { include bind::debian }
+ default : { fail "Unknown ${::operatingsystem}" }
}
- bind::mx {"mx1":
- zone => "domain.ltd",
- owner => "@",
- priority => 1,
- host => "mail.domain.ltd",
- }
-}
-*/
-class bind {
- case $operatingsystem {
- "Debian","Ubuntu": { include bind::debian }
- default: { fail "Unknown $operatingsystem" }
- }
}
diff --git a/manifests/mx.pp b/manifests/mx.pp
index 433c8ea..4404a83 100644
--- a/manifests/mx.pp
+++ b/manifests/mx.pp
@@ -1,22 +1,21 @@
-/*
-
-= Definition: bind::mx
-Creates an MX record.
-
-Arguments:
- *$zone*: Bind::Zone name
- *$owner*: owner of the Resource Record
- *$priority*: MX record priority
- *$host*: target of the Resource Record
- *$ttl*: Time to Live for the Resource Record. Optional.
-
-*/
-define bind::mx($ensure=present,
- $zone,
- $owner=false,
- $priority,
- $host,
- $ttl=false) {
+# = Definition: bind::mx
+# Creates an MX record.
+#
+# Arguments:
+# *$zone*: Bind::Zone name
+# *$owner*: owner of the Resource Record
+# *$priority*: MX record priority
+# *$host*: target of the Resource Record
+# *$ttl*: Time to Live for the Resource Record. Optional.
+#
+define bind::mx (
+ $zone,
+ $host,
+ $priority,
+ $ensure = present,
+ $owner = false,
+ $ttl = false
+) {
if $owner {
$_owner = $owner
@@ -27,9 +26,10 @@ define bind::mx($ensure=present,
concat::fragment {"bind.${name}":
ensure => $ensure,
target => "/etc/bind/pri/${zone}.conf",
- content => template("bind/mx-record.erb"),
- notify => Service["bind9"],
+ content => template('bind/mx-record.erb'),
+ notify => Service['bind9'],
require => [Bind::Zone[$zone], Bind::A[$host]],
}
+
}
diff --git a/manifests/ns.pp b/manifests/ns.pp
index 3d07aea..e0fbeef 100644
--- a/manifests/ns.pp
+++ b/manifests/ns.pp
@@ -1,27 +1,28 @@
-/*
-
-= Definition: bind::ns
-Creates an NS record.
-
-Arguments:
- *$zone*: Bind::Zone name
- *$owner*: owner of the Resource Record
- *$host*: target of the Resource Record
- *$ttl*: Time to Live for the Resource Record. Optional.
-
-*/
-define bind::ns($ensure=present,
- $zone,
- $owner=false,
- $host,
- $ttl=false) {
+# = Definition: bind::ns
+#
+# Creates an NS record.
+#
+# Arguments:
+# *$zone*: Bind::Zone name
+# *$owner*: owner of the Resource Record
+# *$host*: target of the Resource Record
+# *$ttl*: Time to Live for the Resource Record. Optional.
+#
+define bind::ns (
+ $zone,
+ $host,
+ $ensure = present,
+ $owner = false,
+ $ttl = false
+) {
bind::record {$name:
- ensure => $ensure,
- zone => $zone,
- owner => $owner,
- host => $host,
- ttl => $ttl,
+ ensure => $ensure,
+ zone => $zone,
+ owner => $owner,
+ host => $host,
+ ttl => $ttl,
record_type => 'NS',
}
+
}
diff --git a/manifests/ptr.pp b/manifests/ptr.pp
index 1904c5d..d4bb052 100644
--- a/manifests/ptr.pp
+++ b/manifests/ptr.pp
@@ -1,27 +1,28 @@
-/*
-
-= Definition: bind::ptr
-Creates a PTR record.
-
-Arguments:
- *$zone*: Bind::Zone name
- *$owner*: number of the Resource Record
- *$host*: target of the Resource Record
- *$ttl*: Time to Live for the Resource Record. Optional.
-
-*/
-define bind::ptr($ensure=present,
- $zone,
- $owner=false,
- $host,
- $ttl=false) {
+# = Definition: bind::ptr
+#
+# Creates a PTR record.
+#
+# Arguments:
+# *$zone*: Bind::Zone name
+# *$owner*: number of the Resource Record
+# *$host*: target of the Resource Record
+# *$ttl*: Time to Live for the Resource Record. Optional.
+#
+define bind::ptr(
+ $zone,
+ $host,
+ $ensure = present,
+ $owner = false,
+ $ttl = false
+) {
bind::record {$name:
- ensure => $ensure,
- zone => $zone,
- owner => $owner,
- host => $host,
- ttl => $ttl,
+ ensure => $ensure,
+ zone => $zone,
+ owner => $owner,
+ host => $host,
+ ttl => $ttl,
record_type => 'PTR',
}
+
}
diff --git a/manifests/record.pp b/manifests/record.pp
index ef53833..dc43aaa 100644
--- a/manifests/record.pp
+++ b/manifests/record.pp
@@ -1,24 +1,24 @@
-/*
-
-= Definition: bind::record
-Helper to create any record you want (but NOT MX, please refer to Bind::Mx)
-
-Arguments:
- *$zone*: Bind::Zone name
- *$owner*: owner of the Resource Record
- *$host*: target of the Resource Record
- *$record_type°: resource record type
- *$record_class*: resource record class. Default "IN".
- *$ttl*: Time to Live for the Resource Record. Optional.
-
-*/
-define bind::record($ensure=present,
- $zone,
- $owner=false,
- $host,
- $record_type,
- $record_class='IN',
- $ttl=false) {
+# = Definition: bind::record
+#
+# Helper to create any record you want (but NOT MX, please refer to Bind::Mx)
+#
+# Arguments:
+# *$zone*: Bind::Zone name
+# *$owner*: owner of the Resource Record
+# *$host*: target of the Resource Record
+# *$record_type°: resource record type
+# *$record_class*: resource record class. Default "IN".
+# *$ttl*: Time to Live for the Resource Record. Optional.
+#
+define bind::record (
+ $zone,
+ $host,
+ $record_type,
+ $ensure = present,
+ $owner = false,
+ $record_class = 'IN',
+ $ttl = false
+) {
if $owner {
$_owner = $owner
@@ -29,7 +29,8 @@ define bind::record($ensure=present,
concat::fragment {"${zone}.${record_type}.${name}":
ensure => $ensure,
target => "/etc/bind/pri/${zone}.conf",
- content => template("bind/default-record.erb"),
- notify => Service["bind9"],
+ content => template('bind/default-record.erb'),
+ notify => Service['bind9'],
}
+
}
diff --git a/manifests/txt.pp b/manifests/txt.pp
index 31dd189..92b3ba4 100644
--- a/manifests/txt.pp
+++ b/manifests/txt.pp
@@ -1,27 +1,28 @@
-/*
-
-= Definition: bind::txt
-Creates an IPv4 record.
-
-Arguments:
- *$zone*: Bind::Zone name
- *$owner*: owner of the Resource Record
- *$text*: target of the Resource Record
- *$ttl*: Time to Live for the Resource Record. Optional.
-
-*/
-define bind::txt($ensure=present,
- $zone,
- $owner=false,
- $text,
- $ttl=false) {
+# = Definition: bind::txt
+#
+# Creates an IPv4 record.
+#
+# Arguments:
+# *$zone*: Bind::Zone name
+# *$owner*: owner of the Resource Record
+# *$text*: target of the Resource Record
+# *$ttl*: Time to Live for the Resource Record. Optional.
+#
+define bind::txt (
+ $zone,
+ $text,
+ $ensure = present,
+ $owner = false,
+ $ttl = false
+) {
bind::record {$name:
- ensure => $ensure,
- zone => $zone,
- owner => $owner,
- host => $text,
- ttl => $ttl,
+ ensure => $ensure,
+ zone => $zone,
+ owner => $owner,
+ host => $text,
+ ttl => $ttl,
record_type => 'TXT',
}
+
}
diff --git a/manifests/zone.pp b/manifests/zone.pp
index 6829569..eb07746 100644
--- a/manifests/zone.pp
+++ b/manifests/zone.pp
@@ -1,41 +1,41 @@
-/*
+# = Definition: bind::zone
+#
+# Creates a valid Bind9 zone.
+#
+# Arguments:
+# *$is_slave*: Boolean. Is your zone a slave or a master? Default false
+# *$zone_ttl*: Time period. Time to live for your zonefile (master only)
+# *$zone_contact*: Valid contact record (master only)
+# *$zone_serial*: Integer. Zone serial (master only)
+# *$zone_refresh*: Time period. Time between each slave refresh (master only)
+# *$zone_retry*: Time period. Time between each slave retry (master only)
+# *$zone_expiracy*: Time period. Slave expiracy time (master only)
+# *$zone_ns*: Valid NS for this zone (master only)
+# *$zone_xfers*: IPs. Valid xfers for zone (master only)
+# *$zone_masters*: IPs. Valid master for this zone (slave only)
+# *$zone_origin*: The origin of the zone
+#
+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,
+ $zone_origin = false
+) {
-= Definition: bind::zone
-Creates a valid Bind9 zone.
-
-Arguments:
- *$is_slave*: Boolean. Is your zone a slave or a master? Default false
- *$zone_ttl*: Time period. Time to live for your zonefile (master only)
- *$zone_contact*: Valid contact record (master only)
- *$zone_serial*: Integer. Zone serial (master only)
- *$zone_refresh*: Time period. Time between each slave refresh (master only)
- *$zone_retry*: Time period. Time between each slave retry (master only)
- *$zone_expiracy*: Time period. Slave expiracy time (master only)
- *$zone_ns*: Valid NS for this zone (master only)
- *$zone_xfers*: IPs. Valid xfers for zone (master only)
- *$zone_masters*: IPs. Valid master for this zone (slave only)
- *$zone_origin*: The origin of the zone
-
-*/
-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,
- $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,
@@ -45,16 +45,16 @@ define bind::zone($ensure=present,
concat::fragment {"bind.zones.${name}":
ensure => $ensure,
target => "/etc/bind/zones/${name}.conf",
- notify => Service["bind9"],
- require => Package["bind9"],
+ notify => Service['bind9'],
+ require => Package['bind9'],
}
concat::fragment {"named.local.zone.${name}":
ensure => $ensure,
- target => "/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"],
+ notify => Service['bind9'],
+ require => Package['bind9'],
}
if $is_slave {
@@ -62,7 +62,7 @@ define bind::zone($ensure=present,
fail "No master defined for ${name}!"
}
Concat::Fragment["bind.zones.${name}"] {
- content => template("bind/zone-slave.erb"),
+ content => template('bind/zone-slave.erb'),
}
## END of slave
} else {
@@ -80,23 +80,24 @@ define bind::zone($ensure=present,
}
Concat::Fragment["bind.zones.${name}"] {
- content => template("bind/zone-master.erb"),
+ content => template('bind/zone-master.erb'),
}
concat::fragment {"00.bind.${name}":
ensure => $ensure,
target => "/etc/bind/pri/${name}.conf",
- content => template("bind/zone-header.erb"),
- require => Package["bind9"],
+ content => template('bind/zone-header.erb'),
+ require => Package['bind9'],
}
file {"/etc/bind/pri/${name}.conf.d":
ensure => absent,
- mode => 0700,
+ mode => '0700',
purge => true,
recurse => true,
backup => false,
force => true,
}
}
+
}