summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaël Pinson <raphael.pinson@camptocamp.com>2012-03-26 15:34:28 +0200
committerRaphaël Pinson <raphael.pinson@camptocamp.com>2012-03-26 15:34:28 +0200
commit60515f980483225bf48c728bf30cda84a90a911a (patch)
tree76d2de09131ebfd448532ad8933f013bb04cf1ff
parentea7b48f76a9fbb03ee1229c168748e93f5d78984 (diff)
downloadpuppet-bind-60515f980483225bf48c728bf30cda84a90a911a.tar.gz
puppet-bind-60515f980483225bf48c728bf30cda84a90a911a.tar.bz2
Create PTR records from A records
-rw-r--r--manifests/a.pp17
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,
+ }
}