2022-11-09 13:11:22 +00:00
|
|
|
# {{ 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 %}
|
2022-11-10 15:44:43 +00:00
|
|
|
states = [ {{ dependency.states | join(', ') }} ]
|
2022-11-09 13:11:22 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2022-11-10 15:44:43 +00:00
|
|
|
{% if dependency.assign is defined %}
|
2022-11-09 13:11:22 +00:00
|
|
|
assign where {{ dependency.assign }}
|
2022-11-10 15:44:43 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if dependency.ignore is defined %}
|
|
|
|
ignore where {{ dependency.ignore }}
|
|
|
|
{% endif %}
|
2022-11-09 13:11:22 +00:00
|
|
|
}
|
|
|
|
{% endfor %}
|