diff --git a/manifests/srv.pp b/manifests/srv.pp index f7bcbd8..c34d830 100644 --- a/manifests/srv.pp +++ b/manifests/srv.pp @@ -1,15 +1,27 @@ # Create an dnsmasq srv record (--srv-host). define dnsmasq::srv ( + $record = undef, $hostname, $port, $priority = undef, + $weigth = undef, ) { validate_re($port,'^[0-9]+$') if undef != $priority { validate_re($port,'^[0-9]+$') } + $record_real = $record ? { + undef => "${name}", + default => "${record}", + } + $priority_real = $priority ? { - undef => '', - default => ",${priority}", + undef => ',0', + default => "${priority}", + } + + $weight_real = $weight ? { + undef => ',0', + default => "${weigth}", } include dnsmasq diff --git a/templates/srv.erb b/templates/srv.erb index 35e32b3..e2bb044 100644 --- a/templates/srv.erb +++ b/templates/srv.erb @@ -1 +1 @@ -srv-host=<%= @name %>,<%= @hostname %>,<%= @port %><%= @priority_real %> +srv-host=<%= @record_real %>,<%= @hostname %>,<%= @port %>,<%= @priority_real %>,<%= @weight_real %>