Set host/service variable in apply rules

fixes #7479