ansible-role-icinga2/templates/notifications.conf.j2

38 lines
1.1 KiB
Text
Raw Normal View History

2021-01-03 15:10:04 +00:00
# {{ ansible_managed }}
{% for name, notification in icinga2_notifications.items() %}
apply Notification "{{ name }}" to {{ notification.type }} {
import "{{ notification.import }}"
assign where {{ notification.assign }}
user_groups = {{ notification.groups }}
users = {{ notification.users }}
{% if notification.options is defined %}
{% for option, value in notification.options.items() %}
{% if value is sameas True %}
{{ option }} = true
{% elif value is sameas False %}
{{ option }} = false
{% elif value is number or value|regex_search('^[0-9]+(s|m|h|d)$') or option in ['period', 'zone'] %}
{{ option }} = {{ value }}
{% else %}
{{ option }} = "{{ value }}"
{% endif %}
{% endfor %}
{% endif %}
{% if notification.vars is defined %}
{% for var, value in notification.vars.items() %}
{% if value is sameas True %}
vars.{{ var }} = true
{% elif value is sameas False %}
vars.{{ var }} = false
{% elif value is number or value|regex_search('^[0-9]+(s|m|h|d)$') %}
vars.{{ var }} = {{ value }}
{% else %}
vars.{{ var }} = "{{ value }}"
{% endif %}
{% endfor %}
{% endif %}
}
{% endfor %}