# {{ 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 = [ {{ value | join(', ') }} ] {% endif %} assign where {{ dependency.assign }} } {% endfor %}