How do you handle centos-release package adding extra yum mirrors?

I want to install RPMs only from my katello server but when I install rpm centos-release many new .repo files are added to the folder /etc/yum.repos.d/ pointing to the upstream yum repositories.

I thought about defining a filter in katello to skip the centos-release rpm but it also provides some other useful files e.g. /etc/redhat-release . I think I will configure my ansible playbooks to delete the extra .repos files added by this package but I wanted to ask how others are dealing with this. Is there any other more elegant way to deal with it that I am missing?

thanks!

RPM has a --excludepath option, but I don’t know if you can configure the system to use this so a yum update won’t overwrite them anyway.

1 Like

I am not aware of a more elegant solution and use also always configuration management to disable or remove additional repositories. In some environments this can be done quite easily, in others were additional repositories are allowed for additional software not included in RHEL/CentOS repositories it is more difficult.

1 Like

One option is to empty the .repo files during the installation process. Otherwise they will be overwritten during an update procedure.
We use subscription_manager to solve this issue for orcharhino directly.
@Bernhard_Suttner opened a pull request for this: https://github.com/candlepin/subscription-manager/pull/1961

1 Like

thanks for all the suggestions. By now I will empty the .repo files with ansible and I will follow the status of the PR by @hlawatschek

In case it helps, this is how I am disabling the default centos yum repositories using ansible (check lines 26 to 68)