From 90d22283aac953e6c44d47f0d0fdefdab6e816d6 Mon Sep 17 00:00:00 2001 From: Nick Chappell Date: Mon, 28 Jul 2014 19:24:39 -0700 Subject: [PATCH] Added a parameter and default value for the groups parameter; added it to the service object ERB template. --- manifests/object/service.pp | 4 ++-- templates/object_service.conf.erb | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/manifests/object/service.pp b/manifests/object/service.pp index 2c6c95c..e970744 100644 --- a/manifests/object/service.pp +++ b/manifests/object/service.pp @@ -13,9 +13,9 @@ define icinga2::object::service ( $object_servicename = $name, $template_to_import = 'generic-service', $display_name = $name, - $host_name = $fqdn, + $host_name = $fqdn, + $groups = [], #Parameters to add: - # * groups # * vars # * check_command # * max_check_attempts diff --git a/templates/object_service.conf.erb b/templates/object_service.conf.erb index 1daa337..e75b67a 100644 --- a/templates/object_service.conf.erb +++ b/templates/object_service.conf.erb @@ -11,7 +11,6 @@ */ // Parameters to add: -// * groups // * vars // * check_command // * max_check_attempts @@ -45,4 +44,7 @@ object Service "<%= @object_servicename %>" { <%- if @host_name -%> host_name = "<%= @host_name -%>" <%- end -%> + <%- if @groups.length != 0 -%> + groups = [ <%- @groups.each do |group| -%> "<%= group %>", <%- end -%>] + <%- end -%> }