summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaël Pinson <raphael.pinson@camptocamp.com>2012-03-29 19:43:18 +0200
committerRaphaël Pinson <raphael.pinson@camptocamp.com>2012-03-29 19:44:53 +0200
commitfb0938204019fd14b030605ca8047f1c623bc38c (patch)
treeff366df4d191a1ff3418106f9fc5a8b8e1b2b712
parentfa03e03fce3d604eeb90bdf11bf574f3b70845dc (diff)
downloadpuppet-bind-fb0938204019fd14b030605ca8047f1c623bc38c.tar.gz
puppet-bind-fb0938204019fd14b030605ca8047f1c623bc38c.tar.bz2
Fix PTR by calculating arpa zones with IPAddr.new(host).reverse
-rw-r--r--manifests/a.pp8
-rw-r--r--manifests/zone.pp6
-rw-r--r--templates/zone-header.erb3
3 files changed, 11 insertions, 6 deletions
diff --git a/manifests/a.pp b/manifests/a.pp
index 6797ab3..41fdee8 100644
--- a/manifests/a.pp
+++ b/manifests/a.pp
@@ -28,12 +28,12 @@ define bind::a($ensure=present,
}
if $ptr {
- $subnet = inline_template("<%= host.split('.')[0,3].join('.') %>")
- $number = inline_template("<%= host.split('.')[3] %>")
+ $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 {$host:
+ bind::ptr {"${arpa}.":
ensure => $ensure,
- zone => $subnet,
+ zone => $arpa_zone,
host => $name,
ttl => $ttl,
}
diff --git a/manifests/zone.pp b/manifests/zone.pp
index 64da5da..62df7fc 100644
--- a/manifests/zone.pp
+++ b/manifests/zone.pp
@@ -14,6 +14,7 @@ Arguments:
*$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,
@@ -26,7 +27,8 @@ define bind::zone($ensure=present,
$zone_expiracy="1w",
$zone_ns=false,
$zone_xfers=false,
- $zone_masters=false) {
+ $zone_masters=false,
+ $zone_origin=false) {
common::concatfilepart {"bind.zones.${name}":
ensure => $ensure,
@@ -69,7 +71,7 @@ define bind::zone($ensure=present,
content => template("bind/zone-master.erb"),
}
- common::concatfilepart {"bind.00.${name}":
+ common::concatfilepart {"00.bind.${name}":
ensure => $ensure,
file => "/etc/bind/pri/${name}.conf",
content => template("bind/zone-header.erb"),
diff --git a/templates/zone-header.erb b/templates/zone-header.erb
index da93b31..418aef8 100644
--- a/templates/zone-header.erb
+++ b/templates/zone-header.erb
@@ -1,5 +1,8 @@
; File managed by puppet
$TTL <%=zone_ttl%>
+<% if zone_origin -%>
+$ORIGIN <%=zone_origin%>
+<% end -%>
@ IN SOA <%=name%>. <%=zone_contact%>. (
<%=zone_serial%> ; serial
<%=zone_refresh%> ; refresh