Adapt default location based on smart proxy used for registration

Hi there, I have a simple question : is it possible to automatically assign a location to a host registering on Katello via subscription-manager based on which smart proxy it used ?

As an example, I have 2 sites : ITX and AWS, I have a smart proxy for each, when I register my hosts via subscribe manager and with a smart proxy :

curl --insecure --output katello-ca-consumer-latest.noarch.rpm https://AWS/pub/katello-ca-consumer-latest.noarch.rpmyum localinstall katello-ca-consumer-latest.noarch.rpm 
subcription-manager etc ...

Expected outcome:
My host should be in the AWS location, however, it’s in the ITX one, as it’s the default one for registration
I can override where it’s registered by putting a file like that

# cat /etc/rhsm/facts/location.facts 

But I don’t find that ideal, is there nicer way to achieve that ? like setting default_location to a specific value like “inherit smart proxy” ?

Foreman and Proxy versions:

Foreman and Proxy plugin versions:
All smart-proxy are 1.22

|foreman-tasks| |0.15.5|

Distribution and version:
Centos 7

Thank you

@loitho Hey, thanks for writing in! You can set a default location using the Default location setting in the Puppet tab under Settings, but this is globally scoped, so not sure if it will be exactly what you are looking for.

I think you may find the bootstrap script helpful, it looks like it can control Location as well.

Let me know if you have any more questions!

Hi, thanks for your reply

I saw the default_location value, what I’m trying to achieve is just to be able to have the smart proxy location applied to the host registering himself on foreman through the smart proxy.

I would like the “default_location” to be “same as smart proxy used for registration” if that makes sense.
The bootstrap script is quite nice, but in my environment it doesn’t quite works, I’m better simply using the subscription-manager command.
I’ll just update the location.facts file accordingly :slight_smile:

Sorry we couldn’t find a better solution, that sounds like the best bet for now!

That’s okay, I just want to use the most appropriate one :slight_smile:
Thank you again for your replies

1 Like

+1 on this topic.
If it is not possible to set default location based on which smart proxy server subscribed is it possible to do so based on activation key used?
Thank you

@matemikulic can you file an feature request here?

Sure @John_Mitsch Request opened. Feature #29353: Subscribed server assumes location of smart proxy used to register - feature request - Katello - Foreman
Thanks :slight_smile:

1 Like