From b3e5b6e81fad0181f2d884f35efa875c7b7fa0e1 Mon Sep 17 00:00:00 2001 From: Cédric Jeanneret Date: Mon, 29 Nov 2010 09:46:46 +0100 Subject: bind - simplification for bind::* definitions. namevar can be used as "$owner", if $owner is not set. --- manifests/definitions/bind-a.pp | 2 +- manifests/definitions/bind-aaaa.pp | 2 +- manifests/definitions/bind-cname.pp | 2 +- manifests/definitions/bind-mx.pp | 8 +++++++- manifests/definitions/bind-ns.pp | 2 +- manifests/definitions/bind-record.pp | 8 +++++++- templates/default-record.erb | 4 ++-- 7 files changed, 20 insertions(+), 8 deletions(-) diff --git a/manifests/definitions/bind-a.pp b/manifests/definitions/bind-a.pp index b0947d1..3f30187 100644 --- a/manifests/definitions/bind-a.pp +++ b/manifests/definitions/bind-a.pp @@ -12,7 +12,7 @@ Arguments: */ define bind::a($ensure=present, $zone, - $owner, + $owner=false, $host, $ttl=false) { diff --git a/manifests/definitions/bind-aaaa.pp b/manifests/definitions/bind-aaaa.pp index e91e162..80291c2 100644 --- a/manifests/definitions/bind-aaaa.pp +++ b/manifests/definitions/bind-aaaa.pp @@ -12,7 +12,7 @@ Arguments: */ define bind::aaaa($ensure=present, $zone, - $owner, + $owner=false, $host, $ttl=false) { diff --git a/manifests/definitions/bind-cname.pp b/manifests/definitions/bind-cname.pp index d5e8209..c8baeec 100644 --- a/manifests/definitions/bind-cname.pp +++ b/manifests/definitions/bind-cname.pp @@ -12,7 +12,7 @@ Arguments: */ define bind::cname($ensure=present, $zone, - $owner, + $owner=false, $host, $ttl=false) { diff --git a/manifests/definitions/bind-mx.pp b/manifests/definitions/bind-mx.pp index 5090932..84a2b9f 100644 --- a/manifests/definitions/bind-mx.pp +++ b/manifests/definitions/bind-mx.pp @@ -13,11 +13,17 @@ Arguments: */ define bind::mx($ensure=present, $zone, - $owner, + $owner=false, $priority, $host, $ttl=false) { + if $owner { + $_owner = $owner + } else { + $_owner = $name + } + common::concatfilepart{"bind.${name}": file => "/etc/bind/pri/${zone}", ensure => $ensure, diff --git a/manifests/definitions/bind-ns.pp b/manifests/definitions/bind-ns.pp index 065575f..3d07aea 100644 --- a/manifests/definitions/bind-ns.pp +++ b/manifests/definitions/bind-ns.pp @@ -12,7 +12,7 @@ Arguments: */ define bind::ns($ensure=present, $zone, - $owner, + $owner=false, $host, $ttl=false) { diff --git a/manifests/definitions/bind-record.pp b/manifests/definitions/bind-record.pp index 5436a99..d551d60 100644 --- a/manifests/definitions/bind-record.pp +++ b/manifests/definitions/bind-record.pp @@ -14,12 +14,18 @@ Arguments: */ define bind::record($ensure=present, $zone, - $owner, + $owner=false, $host, $record_type, $record_class='IN', $ttl=false) { + if $owner { + $_owner = $owner + } else { + $_owner = $name + } + common::concatfilepart {"${zone}.${record_type}.${name}": ensure => $ensure, file => "/etc/bind/pri/${zone}.conf", diff --git a/templates/default-record.erb b/templates/default-record.erb index 112ae2f..16b839f 100644 --- a/templates/default-record.erb +++ b/templates/default-record.erb @@ -1,5 +1,5 @@ <% if ttl -%> -<%=owner%> <%=ttl%> <%=record_class%> <%=record_type%> <%=host%> +<%=_owner%> <%=ttl%> <%=record_class%> <%=record_type%> <%=host%> <% else -%> -<%=owner%> <%=record_class%> <%=record_type%> <%=host%> +<%=_owner%> <%=record_class%> <%=record_type%> <%=host%> <% end -%> -- cgit v1.2.3