adding erb template for use with adding notifications to host define
Signed-off-by: Nick Chappell <nick@intronic.org> Merged from: https://github.com/Icinga/puppet-icinga2/pull/43 refs#7676: https://dev.icinga.org/issues/7676
This commit is contained in:
parent
ade087a21b
commit
4b269e4b25
1 changed files with 64 additions and 0 deletions
64
templates/object_apply_notification_to_host.conf.erb
Normal file
64
templates/object_apply_notification_to_host.conf.erb
Normal file
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* WARNING: This service definition is automatically generated by Puppet.
|
||||
* ANY MANUAL CHANGES TO IT WILL GET OVERWRITTEN!
|
||||
*/
|
||||
|
||||
/**
|
||||
* A object definition that applys notifications to hosts. You can create your
|
||||
* own configuration files in the conf.d directory (e.g. one per host).
|
||||
* By default all *.conf files in this directory are included.
|
||||
*
|
||||
*/
|
||||
|
||||
apply Notification "<%= @object_notificationname %>" to Host {
|
||||
<%#- If any of the @ parameters are undefined, don't print anything for them: -%>
|
||||
<%- if @notification_to_import -%>
|
||||
<%#- Otherwise, include the parameter: -%>
|
||||
import "<%= @notification_to_import %>"
|
||||
<%- end -%>
|
||||
<%- if @assign_where -%>
|
||||
assign where <%= @assign_where %>
|
||||
<%- end -%>
|
||||
<%- if @ignore_where -%>
|
||||
ignore where <%= @ignore_where %>
|
||||
<%- end -%>
|
||||
<%- if @command -%>
|
||||
command = "<%= @command %>"
|
||||
<%- end -%>
|
||||
<%- if @vars.empty? != true -%>
|
||||
<%- @vars.each_pair do |key,value| -%>
|
||||
<%= key %> = <% if value.class == String %><%= value %>
|
||||
<%- else -%>{
|
||||
<%- value.each_pair do |k,v| -%>
|
||||
<%= k %> = <%= v %>
|
||||
<%- end -%>
|
||||
}
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
<%- end -%>
|
||||
<%- if @users.empty? !=true -%>
|
||||
users = [ <% @users.each_with_index do |usr, i| %>"<%= usr -%>"<%= ', ' if i < (@users.size - 1) %><% end %> ]
|
||||
<%- end -%>
|
||||
<%- if @user_groups.empty? !=true -%>
|
||||
user_groups = [ <% @user_groups.each_with_index do |u_grp, i| %>"<%= u_grp -%>"<%= ', ' if i < (@user_groups.size - 1) %><% end %> ]
|
||||
<%- end -%>
|
||||
<%- if @times.empty? != true -%>
|
||||
times = {
|
||||
<%- @times.each_pair do |key,value| -%>
|
||||
<%= key %> = "<%= value %>"
|
||||
<%- end -%>
|
||||
}
|
||||
<%- end -%>
|
||||
<%- if @interval -%>
|
||||
interval = "<%= @inteval -%>"
|
||||
<%- end -%>
|
||||
<%- if @period -%>
|
||||
period = "<%= @period -%>"
|
||||
<%- end -%>
|
||||
<%- if @types.empty? !=true -%>
|
||||
types = [ <% @types.each_with_index do |typ, i| %><%= typ -%><%= ', ' if i < (@types.size - 1) %><% end %> ]
|
||||
<%- end -%>
|
||||
<%- if @states.empty? !=true -%>
|
||||
states = [ <% @states.each_with_index do |state, i| %><%= state -%><%= ', ' if i < (@states.size - 1) %><% end %> ]
|
||||
<%- end -%>
|
||||
}
|
Loading…
Reference in a new issue