diff options
-rw-r--r-- | manifests/a.pp | 17 |
1 files changed, 16 insertions, 1 deletions
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, + } } |