]> gitweb.fluxo.info Git - puppet-bind.git/commitdiff
Fix PTR by calculating arpa zones with IPAddr.new(host).reverse
authorRaphaël Pinson <raphael.pinson@camptocamp.com>
Thu, 29 Mar 2012 17:43:18 +0000 (19:43 +0200)
committerRaphaël Pinson <raphael.pinson@camptocamp.com>
Thu, 29 Mar 2012 17:44:53 +0000 (19:44 +0200)
manifests/a.pp
manifests/zone.pp
templates/zone-header.erb

index 6797ab39e9fe6f6a8864d99ba887b78761f0360a..41fdee869cd57259cc413b5cd5a9d2ca37afc5ea 100644 (file)
@@ -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,
     }
index 64da5da5486058e2468ed9ad0deb1d28b3cbe0e1..62df7fc3f8904a9597c9b1b6ff5d88466e4da9fc 100644 (file)
@@ -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"),
index da93b3161f1b2cce94621d638e0dfcb61a4f3923..418aef8602c6ca6668fc0cd62ae6f1c31a191d61 100644 (file)
@@ -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