Possible to add a host to a host group when register with activation key?

How do you automatically add that host to a host group when registering a host with an activation key?
There is the “Activation Keys” tab when I edit a host group but adding a key there and then register a host with that key does not add the host to that host group. Is there something I missed?
Background is that I am using ansible for scap setup and trying to automate the scap proxy setting and setting the scap policy and looks like host groups is the way to go here.

Hi @tedevil

Is there any tracebacks or errors in the /var/log/foreman/production.log when you register a host with the activation key?

1 Like

Looking at the text when I configure the activation key in a host group it says:

“The value will be available in templates as @host.params[‘kt_activation_keys’]”

This makes me suspect that the intention is actually not to add the host to the host groups when using the activation key but to just set a variable. Also it is sorta unpractical to use it since the life cycle environment and content view must be set in the host group and match that of the activation key. My preference is to leave life cycle environment and content view unset in the host group and let the activation key do that work. I do not want to be forced creating one host group for each activation key.

Would have been nice to be able to select a host group in the activation key though. For now I guess I just have to set the host group manually after adding a host with a activation key.