# File managed by Ansible # HOSTGROUPS DEFINITIONS {% if hostgroups %}{% for group in hostgroups %} # Group {{ group.hostgroup_name }} define hostgroup{ {% for key, value in group.items() %} {% if key != "members" and key != "services" %} {{ key }} {{ value }} {% endif %} {% endfor %} {% if 'members' in group %} members {{ group.members | join(',') }} {% endif %} } {% if group.services is defined %}{% for service in group.services %} # Service {{ service.service_description }} define service{ use {{ service.service_template |default('local-service') }} hostgroup_name {{ group.hostgroup_name }} service_description {{ service.service_description | replace(" ", "_") }} check_command {{ service.check_command }} notifications_enabled {{ service.notifications_enabled |default(1) }} {% if service.action_url is defined %} action_url {{ service.action_url }} {% endif %} {% if service.notes_url is defined %} notes_url {{ service.notes_url }} {% endif %} } {% endfor %}{% endif %} {% endfor %}{% endif %}