How Do I Create a Non-Default Repo and Manually Subscribe Specific Hosts in Katello?

Problem:

I need to be able to create a specific repository, for example I want to create a repo for PostGress 11. Right now, all of the repositories I create under my CentOS 7 x64 product are automatically added to all of my hosts in their content section (I do not use any specific Libraries or Content Views right now but maybe I will have to in order to accomplish what I want?). I changed my activation key after I created the repos so that they are disabled by default, but this only seems to affect hosts that are re-joined using that activation. All previous hosts had the repositories enabled immediately after they were created and aren’t switched after I change the activation key.

Foreman and Proxy versions:
Foreman 3.0.2

Foreman and Proxy plugin versions:
Katello 4.2.2

Distribution and version:
CentOS 7 x64

Add PG11 to your present content view, but do not include it in the activation key. Use either the web GUI or hammer to subscribe your chosen hosts.
hammer host subscription attach --help should get you started.

Since you are not using CV yet, I am pretty sure that if you add a new repo to a product that a host has subscribed to, this repo will be automatically added and used by the host. If you however create the new repo under a new product, after repo has been created, just go Content Hosts → Subscriptions → Add for each host.

You are right. Only official RHEL subscriptions contain information about which repositories should be enabled or disabled by default. Any other created product in Katello will always enable all repositories by default. A while ago I have created a feature request but nothing happened so far: Feature #31510: Configure default repository set for subscriptions - Katello - Foreman

Thus, if you add a new repository to an existing product and you want to have it disabled by default on all hosts using that product (or simply all hosts, i.e. even when you subscribe to the product in the future), go to the Content Hosts page, select the hosts you want to change (or all if you want), and choose the “Manage Repository Sets” action.

Now on the " Repository Sets Management" page be careful what you do. It’s very easy to mess up all your enabled/disabled repositories for the selected hosts. As you only want to change the default for a specific product you can search for the product, e.g. “product_name = PostgreSQL”.

Now select the repositories you want to change. Remember: the default status in the last column is always “Enabled” expect for some RedHat repositories if you have, so simply ignore that column. Select those new PG 11 repositories and then choose action “Override to Disabled” and confirm the change with “Yes”. This will override the status to disabled on those repositories for those hosts.

2 Likes

Thank you everyone! Tedevil, I like the idea of adding a new product and new repo, and then keeping the unique repos that hosts need to be manually subscribed to in there. I will have to test that out.

gvde, thank you for that detailed response. I had fumbled around and found that page before but was having trouble finding it again. It seems as though this is a reasonable and simple solution for when we need to add new repos like this, where we simply create the repo, perform the steps you listed to disable it for all existing hosts, and then change the activation key to override to disable for all future hosts and then add as we go.

Bummer that this isn’t a more elegantly supported feature, but the two workarounds sound sufficient for now. Thanks again!