Problem: Foreman seems inconsistent about how to handle Ubuntu OS information as provided by Facter.
Creating an Ubuntu OS and installation medium as described in Provisioning hosts does not seem to jive with how Foreman interprets OS information provided by Facter.
The provisioning guide correctly remarks that for Ubuntu the major version is something like 22.04 or 24.04. This major version only changes when doing a full release-upgrade, e.g. from 22.04 to 24.04. During the lifetime of an Ubuntu host the minor version can change when a new point release is available. It then goes from 24.04 to 24.04.1 or from 22.04.3 to 22.04.4. This happens roughly every six months. The provisioning guide also correctly mentions that the minor version on the OS page should be left empty.
Facter (4.x) correctly reports the major version (in os.release.major
and os.release.full
) but mentions the point release only in os.distro.description
as something like Ubuntu 22.04.3 LTS
. Depending on how the host is kept up-to-date this minor version may never even change (for example when the host only receives security updates). So for most practical purposes the minor version is pretty useless.
However, the OS information gets interpreted wrongly by Foreman, once Puppet reports come in. Case in point: I have just created the Ubuntu 24.04 OS and installation medium as described in the provisioning guide (major version => 24.04):
But soon afterwards Puppet reports come in from hosts already running Ubuntu 24.04, and this automatically creates an entirely new OS variant, using the wrong version data:
We now have two variants of Ubuntu 24.04, and as reports and facts come in, all hosts are associated with the new OS and the wrongly handled OS version information, instead of the original Ubuntu 24.04 variant I created:
This presents a problem because the new Ubuntu 24.04.1 variant in this example has no installation medium, templates or partition tables associated with it. Thus new hosts cannot be provisioned until we re-associate and re-define medium, templates and partition tables with the new variant.
It also makes me wonder how and when Foreman chooses to interpret OS information and create a new variant. Our list of Ubuntu OS versions currently looks like this (yes, we have quite a few hosts that are still running old Ubuntu versions, or have been taken offline but not deleted from the compute resource or Foreman yet):
The funny thing is that the 9 hosts in the above list associated with Ubuntu 20.04.4 and 20.04.5 have not sent a report to Foreman in years because they are offline. Yet they are associated with these automatically created, specific OS variants. Most other hosts, even and especially newer ones, are associated just with “Ubuntu 20.04 LTS”, yet most of these are in reality running at least Ubuntu 20.04.5.
Expected outcome: Not sure; I guess more consistency in handling OS information and OS creation would help? I don’t fully grasp how and why Foreman decides (or decides not) to create an OS variant.
Because the way it is handled now when provisioning a new host the user has to choose from a list of possible OS variants but usually only one of them is correctly set up with an installation medium and associated templates. Yet it is not apparent which variant is correct.
In the above example we have to choose “Ubuntu 20.04 LTS” when we want to create a new host running Ubuntu Focal (20.04), but “Ubuntu 22.04.1 LTS” when we want to create one running Ubuntu Jammy (22.04). This seems inconsistent; why does one of them contain the minor version and the other not?
Foreman and Proxy versions: Version 3.11.1
Foreman and Proxy plugin versions:
Distribution and version: Foreman and Foreman Proxies are running on Ubuntu 20.04.
Other relevant data:
We use Foreman’s “ENC” script to push facts from our Puppetservers to Foreman: puppet-puppetserver_foreman/files/enc.rb at master · theforeman/puppet-puppetserver_foreman · GitHub