Assign one service to RedHat 7,8 but not for 9

Hello community
I have a little dilemma with the definition of one of the services.
There is a need for one service to be assigned to all hosts with RedHat versions 7 and 8.
But I also don’t want this service to be assigned to RedHat 9 hosts.

The goal is for one service to be defined, and only the assign conditions determine its assignment or not.

There is an assign option - but nowhere in the documentation I could find how to precisely determine the version of the assigned system.

assign where “default_agent” in host.vars.mon.roles && host.vars.os == “Linux”

I wouldn’t want to create additional custom roles for hosts.
Does Icinga recognize itself in more details than just host.vars.os ?

host.vars.os is a host custom variable.
you define that in host templates or hosts itself.

object Host "192.168.0.1" {
    import "router"

    display_name = "Router"
    vars.MyCustomVar = "test"
    vars.os = "Linux"
    vars.osversion = "RH7"
}

one idea would be to create host templates for RH7, RH8, RH9 and assign these templates to the correct hosts.

if you use icinga director you have to create a datafield and assign it to a host template.
after filling out the datafield in the template the host variable with the corresponding name will be available.

here are more informations about custom variables:
https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/#custom-variable-values