Provisioning machines do not change the public repos to the repos configured in foreman during the installation

Problem: When I deploy a new virtual machine through Foreman (e.g CentOS 7) with sync content, a content view and activation key, the machine provisioned does not change the public repos to the repos configured in foreman during the installation.
During the installation the new machine need Internet access to install subscription manager 1st and my Linux network do not have access to the Internet.
Is it normal that the installation of a new machines needs Internet access, or should install subscription manager from Foreman itself in order to proceed with registration on Foreman?

Foreman version: 3.3.0 with Katello 4.5.0

Bootdisk plugin versions: 19.0.5

Same with rockyLinux 8 (using satellite). When it is time in the kickstart file to install subscription manager, the repositories from rocky-repos are installed but not disabled, and as there is no internet access (or here just resolution because my dns have no internat access) ; it fails

Starting the subscription-manager registration process
Rocky Linux 8 - AppStream                       0.0  B/s |   0  B     00:00    
Errors during downloading metadata for repository 'appstream':
  - Curl error (6): Couldn't resolve host name for https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=AppStream-8 [Could not resolve host: mirrors.rockylinux.org]
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://mirrors.rockylinux.org/mirrorlist?arch=x86_64&repo=AppStream-8 [Could not resolve host: mirrors.rockylinux.org]
error: Failed dependencies:
        subscription-manager is needed by katello-ca-consumer-satellite...-1.0-1.noarch
Retrieving http://satellite..../pub/katello-ca-consumer-latest.noarch.rpm
/tmp/ks-script-f_0hi2ln: line 49: subscription-manager: command not found

Would there be any workaround for that?

Hello AlexV,

I already solved my issue on Foreman and it was the same fix for Rocky. I also have Rocky on my environment.

On the provisioning template associated to the new machine, I only need to add subscription-manager to install at the same time than yum and dhclient packages. So I only add this to my provisioning template:

image

By default on this part you have:

%packages
<%= snippet_if_exists(template_name + " custom packages") %>
yum
dhclient

And now:

%packages
<%= snippet_if_exists(template_name + " custom packages") %>
yum
dhclient
subscription-manager

With this, when the machine starts, will install subscription-manager and, when it arrive to subscription part, you already have the package and it can register to use your Foreman as source list to your machines.
I don’t know if this also solve the problem on satellite.