Foreman Hooks Orchestration event on specific hostgroup

Problem:

I am wanting to use Foreman Hooks to orchestrate an event (add entry to a load balancer) upon creation of the host.

Obviously, I am wanting to do this only for specific Hosts that are created within a hostgroup for a load balanced application.

How would I configure Foreman to do this? From what I understand - Foreman Hooks will perform these orchestration events on every host - rather than just specific ones in a hostgroup. Is this correct?

Expected outcome:

Execute a shell script to add a line to my apache load balancer configuration for hosts tied to a specific hostgroup.

Foreman and Proxy versions:

Version 3.5.1

Foreman and Proxy plugin versions:

Version 3.5.1

Distribution and version:

CentOS Stream 8

Other relevant data:

@aruzicka or @ofedoren might be able to help here

We have a similar use-case, where we need to execute certain scripts only on specific hostgroups, while other scripts need to run on every host. Lacking a better solution, we resorted to filter by hostgroups within the script. It’s not a very elegant solution, but it works pretty well since hostgroup (and hostgroup[title]) are part of the host objects json the script receives.
If there is a better solution to this problem, I would be interested too though :slight_smile:

As far as I know there is no event filtering in place, so what areyus is doing is the way to go.

Also, foreman hooks or foreman webhooks?