New registered host is missing almost all repositories

Problem:
I’m registering a new client using a custom script. It’s a pretty new installation of Katello. The only registered system is mxktl01 (the server).
I’m using the activation key “Centos 7 x86_64” to which the product “CentOS 7” is attached.
CentOS 7 product has 6 repositories.

When registering a new host, only 1 is added.

Expected outcome:
I expect that all the 6 repositories are added to the new host

Foreman and Proxy versions:
Foreman 3.3.0

Foreman and Proxy plugin versions:
Katello 4.5.0

Distribution and version:
CentOS 7 both client and server

I want to add that I’m using the default content view.
This is the script that I’m using

#! /bin/bash
# Katello client installer for CentOS 7

echo "Installing subscription-manager"
yum install -y subscription-manager

echo 'Copying public key for ssh remote execution'
mkdir /root/.ssh
curl -k https://mxktl01.domain.net:9090/ssh/pubkey >> /root/.ssh/authorized_keys

echo "Cleaning up and disabling Spacewalk"
rm -f /etc/sysconfig/rhn/systemid
sed -i 's/enabled *= *1/enabled=0/' /etc/yum/pluginconf.d/rhnplugin.conf

systemctl disable --now rhnsd
systemctl disable --now rhnmd

echo "Removing old packages"
yum erase -y rhn-setup rhn-client-tools yum-rhn-plugin rhnsd rhn-check rhnlib spacewalk-abrt spacewalk-oscap osad 'rh-*-rhui-client' 'candlepin-cert-consumer-*' 'spacewalk*'

echo "Installing and registering with Katello"
rpm -Uvh https://mxktl01.domain.net/pub/katello-ca-consumer-latest.noarch.rpm
subscription-manager register --org="domain_net" --activationkey="Centos 7 x86_64"

echo "Installing puppet-agent"
yum install -y puppet-agent

echo "If the previous command didn't work, this means that the client isn't able to download packages from Katello"

mkdir -p /etc/puppetlabs/puppet/
echo "Configuring the puppet agent"

echo """[main]
vardir = /opt/puppetlabs/puppet/cache
logdir = /var/log/puppetlabs/puppet
rundir = /var/run/puppetlabs
ssldir = /etc/puppetlabs/puppet/ssl

[agent]
certname = mxktl01.domain.net
server = mxktl01.domain.net,puppet
runinterval = 30m
environment = production
""" >> /etc/puppetlabs/puppet/puppet.conf

echo "Restarting puppet"
systemctl restart puppet

echo "Calling the puppet server"
/opt/puppetlabs/bin/puppet agent -t

echo 'pathmunge /opt/puppetlabs/bin' > /etc/profile.d/puppet.sh
chmod +x /etc/profile.d/puppet.sh

echo "Cleaning Yum"
yum clean all
yum update

echo "Finished"

it gets to the puppet installation and it fails because the system doesn’t install the Puppet repo.

Can anyone can help me?

bump

  1. Are all the repository sets enabled on the activation key?

  2. If you run the following

hammer host subscription enabled-repositories --host-id 1

(replacing 1 with your host’s id),

do the repositories there match the web UI? And are they correct/incorrect?

Hi Jeremy, thanks for your support.
Your exact command doesn’t work, however I found a similar one

[root@mxktl01 ~]# hammer host subscription product-content --host-id 1
---|------------------------------|------------------------------------------------|------------------|---------
ID | NAME                         | LABEL                                          | DEFAULT ENABLED? | OVERRIDE
---|------------------------------|------------------------------------------------|------------------|---------
10 | CentOS 7 Base (x86_64)       | my_domain_CentOS_7_CentOS_7_x86_64_            | yes              |
7  | CentOS 7 Extras (x86_64)     | my_domain_CentOS_7_CentOS_7_Extras_x86_64_     | yes              |
11 | CentOS 7 Updates (x86_64)    | my_domain_CentOS_7_CentOS_7_Updates_x86_64_    | yes              |
8  | Elastic 7.x                  | my_domain_CentOS_7_Elastic_7_x                 | yes              |
9  | EPEL 7 for CentOS 7 (x86_64) | my_domain_CentOS_7_EPEL_7_for_CentOS_7_x86_64_ | yes              |
12 | Puppet 7 for Centos 7        | my_domain_CentOS_7_Puppet_6_for_Centos_7       | yes              |
---|------------------------------|------------------------------------------------|------------------|---------