Deploying OS without Internet + installing Subscription Manager

EDIT: copied over from community, as it really is a support question :slight_smile:
Hi Guys,

For my current environment we want to deploy CentOS7 systems via Foreman/Katello without Internet access.

Cheers!

Problem: Need to install CentOS7 in an environment without internet.

I have synced up Foreman with all the required repos, but when I am observing a OS install (in a lab with internet), I notice the client reaching out to ‘normal’ CentOS repos before installing subscription-manager.

Expected outcome: Install stuff without internet at all :wink:

Foreman and Proxy versions: 2.0.3 / Katello 3.15

Distribution and version: CentOS 7

Without internet access I would disable any repo files except redhat.repo in /etc/yum.repos.d.
I personally zero all unused repos out with a simple bash script:

mkdir -p /etc/yum.repos.d/unused
for repo in $(find /etc/yum.repos.d -maxdepth 1 -name "*.repo" ! -name redhat.repo ! -size 0)
do
        /usr/bin/cp -f $repo /etc/yum.repos.d/unused/
        > $repo
done
1 Like

How do you do that in the kickstart installation? And does the system that is installing itself have access to the repos inside Foreman without being subscribed?

Ok, so I found the solution. First let me try to describe the problem in a different way, I have been getting advice on how to install Foreman on a system without Internet. While helpful (thanks!), it was not the problem I was seeing.

The problem was, building a new client with Foreman (using it’s deployment capabilities) without Internet was an issue. What happened was the follwing (note, this is in a lab without internet):

  • Boot new machine into OS installer
  • Installer started working, installing @Core packages
  • After installation the ‘redhat_register’ snippet runs, complains that subscription-manager cannot be installed and quits
  • Host reboots and is not subscribed to Foreman nor has subscription-manager installed.

The solution is very simple! The ‘Kickstart default’ template mentions in it’s ‘packages’ section that it will include any snippet named "template name + ‘custom packages’ " (in this case ‘Kickstart default custom packages’). So I made that snippet and put in the following line

subscription-manager

The result is that the OS installer now includes the subscription-manager package during the first installation of packages (I noticed that the amount of packages installed increased from 319 to 335).

I think the ‘Kickstart default’ template could be improved by always including subscription-manager, as I can’t really think of a scenario where you don’t want to install it while deploying systems with Foreman.

What do you think?