Register existing ubuntu host in Foreman

Problem:
Need a guide to register an existing Ubuntu server in foreman

Expected outcome:
Manage ubuntu servers from foreman

Foreman and Proxy versions:
foreman-3.4
foreman proxy-3.4

Foreman and Proxy plugin versions:
katello-4.6

Distribution and version:
rocky 8.7
ubuntu 18.04.6

Other relevant data:

Do we have a document for registering ubuntu machine on foreman? I'm trying to use the curl command from the foreman GUI, but I need to have an OS for registration. Also, where can I find the repos that can be used for the product tab in foreman. Thank you. 

In case you have not seen that yet, there is an official content management guide over at https://docs.theforeman.org/3.3/Managing_Content/index-katello.html
I suggest you take a look at it, there are examples for several OSes including deb based ones.
The general workflow should be about the same, you should only need to change the names and URLs appropriately.

As of right now, the “Host Register” page does not fully function with Ubuntu yet. In the meantime, I suggest you have a look at a manual registration: Registering Hosts Running Ubuntu Manually from the orcharhino documentation. You should be able to adapt most steps for Foreman/Katello. You can download a packaged subscription-manager for Ubuntu 20.04+ at apt.atix.de. For Ubuntu 18.04, you could either try Ubuntu 20.04 or Debian 9.

Hi @maximilian,

Im getting this error when trying to install the subscription-manager package to a test machine. I’m getting this error, The following packages have unmet dependencies: python3-subscription-manager : Depends: python3 (< 3.9) but 3.10.6-1~22.04 is to be installed E: Unable to correct problems, you have held broken packages.

Python is already installed. The test machine is an Ubuntu 22.04.

That seems rather strange. I have just tested this in a container running Ubuntu 22.04 and could not reproduce the isse. I installed subscription-manager version 1.28.24-8 and it pulled in the follwowing python packages:

Setting up python3.10 (3.10.6-1~22.04.1) ...
Setting up python3 (3.10.6-1~22.04) ...
...
Setting up apt-transport-katello (1.28.24-8) ...
Setting up python3-subscription-manager (1.28.24-8) ...

subscription-manager automatically installs apt-transport-katello; and I could install katello-upload-profile afterwards without issue.

For testing, I ran the following:

docker run --rm -it ubuntu:jammy
apt-get update && apt-get install -y ca-certificates wget gpg && wget -qO - https://apt.atix.de/atix_gpg.pub | apt-key add - && echo "deb https://apt.atix.de/Ubuntu22LTS/ stable main" >> /etc/apt/sources.list && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y python3-subscription-manager && subscription-manager version

Can you reproduce the issue on another host?

Hi @maximilian,

Thank you for the response. I tried installing on another machine, this time ubuntu 18.04. I used installation steps for ubuntu 20.04 and I got another python error. Can you show me the step by step process you did on installing? I’m fairly new to ubuntu that’s why I not yet familiar with the process. Below is the error message I’m getting. I’m also using WSL for my ubuntu machines.

Hi,

can we use python2 in running subscription manager? Thanks.

This looks like you’re missing python3-ethtools which must be installed/installable on your managed host.

For python2, you could have a look at the packaged subscription-manager for Debian 10 and probably make it work.

You can have a look at my answer above & basically create a small shell script if you split commands at &&.

1 Like