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

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

        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		[% standort.name or host.description or host.fqdn %]
	address		[% host.ip %]
	use		generic-host
[%          IF host.parents.size -%]
	parents		[% host.parents.join(',') %]
[%          END -%]
}
[%
        END;
    END
%]

define hostgroup {
	hostgroup_name	[% hostgroup %]
	alias		[% hostgroup %]
	contact_groups	[% contact_groups or 'network-admins' %]
	members		[% fqdns.join(',') %]
}
