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

33 lines
1 KiB
Django/Jinja

# {{ ansible_managed }}
{% for name, dependency in icinga2_dependencies.items() %}
apply Dependency "{{ name }}" to Service {
{% if dependency.parent_host_name is defined %}
{% if dependency.parent_host_name == "host.name" %}
parent_host_name = host.name
{% else %}
parent_host_name = {{ dependency.parent_host_name }}
{% endif %}
{% endif %}
{% for option in ['parent_service_name', 'child_host_name', 'child_service_name' 'period'] %}
{% if dependency[option] is defined %}
{{ option }} = "{{ dependency[option] }}"
{% endif %}
{% endfor %}
{% for option in ['disable_checks', 'disable_notifications', 'ignore_soft_states'] %}
{% if dependency[option] is defined %}
{{ option }} = {{ dependency[option] | ternary("true", "false") }}
{% endif %}
{% endfor %}
{% if dependency.states is defined %}
states = [ {{ dependency.states | join(', ') }} ]
{% endif %}
{% if dependency.assign is defined %}
assign where {{ dependency.assign }}
{% endif %}
{% if dependency.ignore is defined %}
ignore where {{ dependency.ignore }}
{% endif %}
}
{% endfor %}