ansible-role-icinga2/templates/check_commands.conf.j2
2021-01-03 16:10:04 +01:00

73 lines
1.7 KiB
Django/Jinja

# {{ ansible_managed }}
{% for name, command in icinga2_check_commands.items() %}
object CheckCommand "{{ name }}" {
command = {{ command.command }}
{% if command.arguments is defined %}
arguments = {
{% for argument in command.arguments %}
"{{ argument.name }}" = {
{% if argument.value is defined %}
value = "{{ argument.value }}"
{% else %}
set_if = "{{ argument.set_if }}"
{% endif %}
{% if argument.description is defined %}
description = "{{ argument.description }}"
{% endif %}
{% if argument.required is defined and argument.required %}
required = true
{% endif %}
}
{% endfor %}
}
{% endif %}
{% if command.vars is defined %}
var = {
{% for var, value in command.vars.items() %}
{{ var }} = {% if value is number %}{{ value }}{% else %}"{{ value }}"{% endif %}
{% endfor %}
}
{% endif %}
}
{% endfor %}
{% for name, command in icinga2_event_commands.items() %}
object EventCommand "{{ name }}" {
command = {{ command.command }}
{% if command.arguments is defined %}
arguments = {
{% for argument in command.arguments %}
"{{ argument.name }}" = {
{% if argument.value is defined %}
value = "{{ argument.value }}"
{% else %}
set_if = "{{ argument.set_if }}"
{% endif %}
{% if argument.description is defined %}
description = "{{ argument.description }}"
{% endif %}
{% if argument.required is defined and argument.required %}
required = true
{% endif %}
}
{% endfor %}
}
{% endif %}
{% if command.vars is defined %}
var = {
{% for var, value in command.vars.items() %}
{{ var }} = {% if value is number %}{{ value }}{% else %}"{{ value }}"{% endif %}
{% endfor %}
}
{% endif %}
}
{% endfor %}