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

77 lines
1.8 KiB
Text
Raw Normal View History

2021-01-03 15:10:04 +00:00
# {{ ansible_managed }}
{% for name, command in icinga2_check_commands.items() %}
object CheckCommand "{{ name }}" {
2022-12-08 14:51:18 +00:00
{% if command.command is not string %}
2022-12-08 13:38:35 +00:00
command = ["{{ command.command | join('", "') }}"]
{% else %}
2021-01-03 15:10:04 +00:00
command = {{ command.command }}
2022-12-08 13:38:35 +00:00
{% endif %}
2021-01-03 15:10:04 +00:00
{% 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 %}
2022-12-08 13:38:35 +00:00
vars = {
2021-01-03 15:10:04 +00:00
{% 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 %}
2022-12-08 13:38:35 +00:00
vars = {
2021-01-03 15:10:04 +00:00
{% for var, value in command.vars.items() %}
{{ var }} = {% if value is number %}{{ value }}{% else %}"{{ value }}"{% endif %}
{% endfor %}
}
{% endif %}
}
{% endfor %}