]> gitweb.fluxo.info Git - puppet-bind.git/commitdiff
Create PTR records from A records
authorRaphaël Pinson <raphael.pinson@camptocamp.com>
Mon, 26 Mar 2012 13:34:28 +0000 (15:34 +0200)
committerRaphaël Pinson <raphael.pinson@camptocamp.com>
Mon, 26 Mar 2012 13:34:28 +0000 (15:34 +0200)
manifests/a.pp

index 3f30187ae0b60e0b03015ddb9d7939b36ad67301..f2e8bcab385cc35c390499d063dce077ea382d0a 100644 (file)
@@ -8,13 +8,15 @@ Arguments:
  *$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=true)
 
 */
 define bind::a($ensure=present,
     $zone,
     $owner=false,
     $host,
-    $ttl=false) {
+    $ttl=false,
+    $ptr=true) {
 
   bind::record {$name:
     ensure => $ensure,
@@ -24,4 +26,17 @@ define bind::a($ensure=present,
     ttl    => $ttl,
     record_type => 'A',
   }
+
+  if $ptr {
+    $subnet = inline_template(<%= host.split('.')[0,3].join('.') %>) 
+    $number = inline_template(<%= host.split('.')[3] %>)
+    $fqdn = $owner
+
+    bind::ptr {
+      ensure => $ensure,
+      zone   => $subnet,
+      owner  => $number,
+      host   => $fqdn,
+      ttl    => $ttl,
+    }
 }