Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added detect Foreman and disable repos in /etc/yum.repos.d/ except re… #79

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mfabijanic
Copy link

Detect Foreman subscription and disable repos in /etc/yum.repos.d/ except redhat.repo (Foreman repo). This is for servers without internet access with Foreman subscription.

@andrewlukoshko
Copy link
Member

Hello and thank you for contribution!
Please check Shellcheck error.

@andrewlukoshko
Copy link
Member

Thanks.
BTW is it possible that somewhere Foreman is used only to provide some additional repos and don't replace default ones?
Maybe we should check what default repos were enabled/disabled before migration and configure them the same way after?

@mfabijanic
Copy link
Author

This is my migration procedure:

  1. Server
    [root@server ~]# mkdir almalinux-deploy

  2. Admin workstation (with internet access)
    [user@wsadmin ~]$ wget https://repo.almalinux.org/almalinux/almalinux-release-latest-8.x86_64.rpm
    [user@wsadmin ~]$ wget https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
    [user@wsadmin ~]$ scp almalinux-deploy/almalinux-deploy.sh almalinux-release-latest-8.x86_64.rpm RPM-GPG-KEY-AlmaLinux root@server:almalinux-deploy/

  3. Server
    Install Foreman CA cert and register server with AlmaLinux activation key
    [root@server ~]# rpm -ivh http://foreman.example.com/pub/katello-ca-consumer-latest.noarch.rpm
    [root@server ~]# subscription-manager register --org="Company" --activationkey="srv-almalinux8-p"

[root@server ~]# cd /root/almalinux-deploy
[root@server almalinux-deploy]# export ALMA_RELEASE_URL="file:///root/almalinux-deploy/almalinux-release-latest-8.x86_64.rpm"
[root@server almalinux-deploy]# export ALMA_PUBKEY_URL="file:///root/almalinux-deploy/RPM-GPG-KEY-AlmaLinux"
[root@server almalinux-deploy]# ./almalinux-deploy.sh

I use Foreman repositories as the primary, because in my case the server does not have internet access. I only disable the AlmaLinux /etc/yum.repos.d/{almalinux,almalinux-ha,almalinux-powertools}.repo repositories that are from the RPM package almalinux-release that was installed in the previous step. Would it be better to move them to almalinux.repo.DISABLED, almalinux-ha.repo.DISABLED and almalinux-powertools.repo.DISABLED and finally return them to their original names when the migration is complete. I’ve already done and tested this and it’s okay. In that case, I'll have to manually disable AlmaLinux repositories after the migration, but that's fine.
Maybe I should add a script argument (-f) that if Foreman is used as the primary AlmaLinux repository will disable AlmaLinux repositories in repo files like it is currently done? Then I can implement in script to use Foreman repo for instaling almalinux-release-latest-8.x86_64.rpm and RPM-GPG-KEY-AlmaLinux.

@Conan-Kudo
Copy link

Conan-Kudo commented Jul 23, 2021

This would probably be a good case to make almalinux-repos to be split out as a weak dependency of almalinux-release. That way, users like @mfabijanic can filter it out and use AlmaLinux with Foreman without much effort.

@andrewlukoshko
Copy link
Member

Sorry for late reply.
I think adding a script argument for Foreman is a great idea. I just want to propose using --foreman instead of -f because -f usually means force.
And the script behavior without --foreman argument should be exactly the same as before.

@andrewlukoshko
Copy link
Member

@Conan-Kudo interesting idea. But this way AlmaLinux will be one to one to no one ) RHEL doesn't have separate repos package for obvious reasons and CentOS's release package requires it in usual way. I afraid we can brake many users' workflows by not providing repos by default. I'm not sure that weak dependencies are installed by default for all cases even if it's system default for RHEL8.

@Conan-Kudo
Copy link

Recommends installs by default unless you turn weak deps off. That's also useful for people making custom images for mass deployments because they can exclude the repo package and provide their own repo definitions instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants