I found the code a bit opaque myself, and I tried to make it clearer by naming the existing code 'valid_hostgroup', and then introduced a 'valid_hostname' as parallel. Normally I'd push domain logic like this out of the templates, but I couldn't see where to do this here, and I didn't want to be too ambitious for my first PR.

What if we changed the comment to something like: "Only define services that are for single hosts, or existing hostgroups"?