From 60515f980483225bf48c728bf30cda84a90a911a Mon Sep 17 00:00:00 2001 From: Raphaƫl Pinson Date: Mon, 26 Mar 2012 15:34:28 +0200 Subject: Create PTR records from A records --- manifests/a.pp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/manifests/a.pp b/manifests/a.pp index 3f30187..f2e8bca 100644 --- a/manifests/a.pp +++ b/manifests/a.pp @@ -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, + } } -- cgit v1.2.3