76 lines
1.8 KiB
Django/Jinja
76 lines
1.8 KiB
Django/Jinja
# {{ ansible_managed }}
|
|
{% for name, command in icinga2_check_commands.items() %}
|
|
|
|
object CheckCommand "{{ name }}" {
|
|
{% if command.command is not string %}
|
|
command = ["{{ command.command | join('", "') }}"]
|
|
{% else %}
|
|
command = {{ command.command }}
|
|
{% endif %}
|
|
{% 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 %}
|
|
|
|
vars = {
|
|
{% 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 %}
|
|
|
|
vars = {
|
|
{% for var, value in command.vars.items() %}
|
|
{{ var }} = {% if value is number %}{{ value }}{% else %}"{{ value }}"{% endif %}
|
|
|
|
{% endfor %}
|
|
}
|
|
{% endif %}
|
|
}
|
|
{% endfor %}
|