Foreman Ansible Modules - subscriptions and repo overrides of content hosts

In preparation of dooms day (aka foreman EL7 deprecation) I am evaluating setting up a new server using the foreman ansible collection. I extract the information from the database on the old server and basically format everything in yaml.

However, I cannot find anything how to subscribe content hosts to products nor how to set up the repository overrides for content hosts. That’s kind of essential for the migration of the content hosts from the old katello server to the new one. Many of my content hosts have specific subscriptions and repo overrides and maintaining those is essential.

So far I have used only roles from the collection but for the hosts there doesn’t seem to be any role. There is no subscription module. The host module also doesn’t seem to have the capability to set subscriptions or override.

Did I miss it or it is missing?


Not sure this covers all you need, but there is the host module with lifecycle_environment and activation_keys. Also a subscription info module.

I know that. But I cannot set the subscription of the host nor the repository overrides. And I don’t really want to create an activation key for each host to match the current settings.

That gives me information about subscriptions but doesn’t allow me do make any changes…

I need to be able to migrate the client/content hosts to the new katello server maintaining everything as it was before. Clients must have the same access to the same repositories on the old and new server…

You could use the community.general.rhsm_repository and community.general.redhat_subscription modules to do these actions from the client.

There are currently no modules to do that in the Katello API and push that to the clients (even tho Katello does support that).

1 Like

In that case I probably revert to a shell script which I will run on all clients. That could collect all consumed subscriptions and enabled repositories, switch to the new foreman server and attach and enable the required subscriptions and repos…

It’s also too bad that katello doesn’t offer a reactivation key for a host. With spacewalk it was possible to generate a reactivation key for a host which you could use as activation key to link a client to a specific host…