[%
    FOREACH standort IN standorte;
        UNLESS loop.first %]

[%      END -%]
# Standort [% standort.user -%]
[%      IF standort.name.defined %] ([% standort.name %])
[%      END;

        fqdns = [];
        FOREACH host IN standort.hosts %]
[%
            SET host.fqdn = host.ip UNLESS host.fqdn.defined;
            fqdns.push(host.fqdn) -%]
define host {
	host_name	[% host.fqdn %]
	alias		[% host.description or host.fqdn %]
	address		[% host.ip %]
	use		generic-host
[%          FOREACH attr IN host.nagiosconf -%]
	[% attr.key %]		[% attr.value %]
[%          END;
            IF host.parents.size -%]
	parents		[% host.parents.join(',') %]
[%          END -%]
}
[%      END %]
define hostgroup {
	hostgroup_name	[% standort.user %]
	alias		[% standort.name %]
	contact_groups	[% contact_groups or 'network-admins' %]
	members		[% fqdns.join(',') %]
}
[%  END -%]
