Choosing which hosts are assigned application repositories

Problem:
I’m new to foreman and trying to set up some repos for my applications before we migrate to use foreman.
I have the Centos 7 repositories and product assigned to a content view. All hosts get this automatically when registering.
I’d like to be able to choose which hosts receive my application repositories. I have a product for each application and the repositories assigned to those products for their respective application. I can’t see a way to assign the product to a host.

Expected outcome:
I should be able to chose which hosts a product is assigned to when deploying my applications

Foreman and Proxy versions:
Foreman 3.3

Foreman and Proxy plugin versions:
Katello 4.5

Distribution and version:
Centos 7U9

Other relevant data:

1 Like

I think there are largely two ways of doing this (today, @jeremylenz is working on improving this flow and make it better composable):

  • you can create individual content views (or composite content views), each containing centos + one of the app, and then assigning these to the hosts – this gives you very fine grained control over what the hosts will be able to receive, but it comes at a higher maintenance cost as you now have more views to manage
  • you can create multiple activation keys, which will have presets for the right repos to be enabled or disabled, while still referring to a single “all-in-one” contentview

Oh, and we have a Content Management Guide which talks about these topics in greater detail.

3 Likes

In Katello, custom products are always enabled by default (for now.)

On the activation key, you can visit the ‘Repository Sets’ tab and “override to disabled” all repositories you don’t want the hosts to have by default.

For already-registered hosts, you can also do this on the host’s details page (Hosts > All Hosts) or via bulk actions (Hosts > Content Hosts).

You may also want to check out

  • composite content views
  • Restrict to Architecture on individual repos
  • Restrict to OS Version (but won’t work with CentOS, only RHEL).
3 Likes

Thanks Guys.
So it sounds like I can add all my product\repositories to the same Content view along with my Centos 7 repos.
Then disable all applications from the ‘repository sets’ tab leaving only the Centos 7 repos.
And any hosts which need the application repos - I can enable them within each host.

Once I do that is there an easy way to see a list of hosts which have a particular application repository assigned?

On the All Hosts page, you can search for "repository = <repo name>"; I think this should give you what you want.

I added a repository to the content view and published a new version.
I then associated the subscription for the application with the activation key. I can see the repository enabled under “Repository Sets” on the activation key. But the hosts don’t have the repository under “Repository Sets” in their detail page so the hosts can’t use it yet.
Is there something else which I’m missing?

Activation keys only affect hosts at registration time.

If you want to change what repositories a host has access to after registration, you must go to the Repository Sets view on the host’s detail page, not its activation key.

yep but I can’t see the repository under the Repository Sets view on the host’s details page. It still only displays the Centos repositories as the assigned repositories for a host.
Is there anything I need to do to assign the repository to an already registered host?

There should be a toggle there to “Show all” or “Limit to environment.” If you set that to show all, do you see the repository?

If so, then the repo is not available in the host’s content view and lifecycle environment.

You said you published a new content view version. Did you also promote that version to a certain environment? if so, the host would also need to be assigned to that environment.

yep if I select the show all I see them all. If I also select “limit to lifecycle environment” I can see the Centos7 ones and the repository I added.
The lifecycle environment is the same as previous as I only have one. The host is assigned to the latest content view and the lifecycle environment.
It looks ok but I must be missing something

Sounds like you’re using the old page (Hosts > Content hosts)? FYI, there’s a new page under Hosts > All hosts which is much better (select the Content tab, then Repository sets.)

Can you share a screen shot of what’s unexpected?

This is what I see under that view from the host

The host is using the following content view and lifecycle environment which is correct
image

The content view has the following repositories

You can see also that the lifecycle environment has 4 repositories

The issue is that I don’t see the Kamailio repository in the first screenshot so the host is unable to use that repository. It sees 3 repositories instead of 4

I noticed the banner says “Showing all repositories that are available through subscriptions.”

This wording means you’ve got SCA turned off.

I’d recommend going to Administer > Organizations, and edit the org in question. Make sure the “Simple Content Access” checkbox is checked.

Once you do that, you should see the custom repository there.

That sounds like it should work but I don’t have any checkbox in the “Simple Content Access” field. If I select edit I also don’t see anywhere I can enable it

You have to click “Edit” and you’ll see the checkbox on the next screen.

There’s no check box available when I edit the organization.
I found this which mentions needing a Manifest to be imported. We don’t have an Red Hat subscriptions and just run Centos so it doesn’t apply
https://theforeman.org/plugins/katello/3.18/user_guide/simple_content_access/index.html

Ah right, this was changed in Katello 4.6.

In Katello 4.5 you’d have to import a manifest to have the option of SCA.

If you don’t want to upgrade, I suppose you could attach a subscription to the host for the custom product. But I’d still recommend upgrading to 4.6 and turning on SCA.

ah ok we’re running Centos 7. I believe 4.6 is only supported on Centos 8 so no plans to upgrade currently
Attaching to the host will be fine for us.

If I add the product to the content view and don’t add the corresponding subscription to the activation key would that mean that hosts will only get the Centos 7 repos during registration with that activation key?
I would then add the additional subscription(s) on each host as needed.

Yes, that’s correct!

1 Like