30 lines
860 B
Text
30 lines
860 B
Text
|
# {{ ansible_managed }}
|
||
|
{% for name, service in icinga2_services.items() %}
|
||
|
|
||
|
apply Service "{{ name }}" {
|
||
|
import "{{ service.import|default('generic-service') }}"
|
||
|
check_command = "{{ service.check_command }}"
|
||
|
assign where {{ service.assign }}
|
||
|
{% if service.options is defined %}
|
||
|
{% for option, value in service.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)$') %}
|
||
|
{{ option }} = {{ value }}
|
||
|
{% else %}
|
||
|
{{ option }} = "{{ value }}"
|
||
|
{% endif %}
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
{% if service.vars is defined %}
|
||
|
|
||
|
{% for var_name, value in service.vars.items() %}
|
||
|
vars.{{ var_name }} = {% if value is number %}{{ value }}{% else %}"{{ value|replace('\n', ' ') }}"{% endif %}
|
||
|
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
}
|
||
|
{% endfor %}
|