Service group issue

Im very new to icinga2. I have 30 servers for monitoring and only 11 of them have apache installed
So i made a service to check port 80. So only 11 servers are showing service up and others are all critical of course because port 80 is not running there. What i want is, only this 11 servers should get that service and not the other servers. I have made a service group called TCP. I just want the 11 servers to get that service and other servers should ignore it.
Please help.

What I do is put a variable in the host object
and in the service object I check that it has this variable

Add to the host object

The check in the Service object
assign where host.vars.group_to_check_port80 == “1”

apply Service "tcp_check" {
    import "check_tcp"

    assign where "TCP" in host.groups

object Host "SERVER1" {
    import "HOSTTEMPLATE"
    groups = [ "TCP" ]