How To Subscribe To Foreman Duplicate Hostnames

Problem:
In Azure Cloud, there could be more than one VMs with the identical HOSTNAME in different Subscriptions, Resource groups… etc. While Subscribing those to Foreman, we have found out only the last one is eventually persistently registered. We have checked the documentation, UUID should have been the clue, but I do not see the UUID in the properties of the registered host in foreman.
We can not use FQDN, just hostname.

Expected outcome:
Expecting seeing multiple hosts with identical hostnames registered to Foreman

Foreman and Proxy versions:
foreman-3.13.0-1.el9.noarch
foreman-proxy-3.13.0-1.el9.noarch
katello-4.15.0-1.el9.noarch

Foreman and Proxy plugin versions:

Distribution and version:
RHEL9.5 5.14.0-503.35.1.el9_5.x86_64

Other relevant data:
[root@foreman ~]# hammer host info --id 31 --fields “Subscription information/uuid”,Id,Uuid,Name
Id: 31
Name: juanjan-01
Subscription Information:
Uuid: d14cd027-10e3-4e6f-bb0e-8493c8bc215f

[root@foreman ~]#

I do not see the UUID, only Subscription Information UUID, but the actual UUID from
subscription-manager facts | grep -i dmi.system.uuid
dmi.system.uuid: 126E7F84-9ED2-3447-A19E-C243E51508BC

is missing.

Any help appreciated.

Thanks!

Regards
Jan

On the client when you do subscription-manager facts --update do you see any errors on the Foreman server in /var/log/foreman/production.log Also what OS version are the clients? Any customization?

I’m not certain we support hosts with duplicate hostnames. I just tried the following:

[3] pry(main)> Host.first.hostname
=> "centos9-stream.c4e53095.manicotto.example.com"
[4] pry(main)> Host.second.name
=> "centos9-stream.68270e32.manicotto.example.com"
[5] pry(main)> Host.second.update(hostname: "centos9-stream.c4e53095.manicotto.example.com")
2025-04-10T20:15:12 [W|app|] Not queueing Host::Managed: ["Name has already been taken"]

It looks like even on a DB level the hostnames must be unique.

Also note, the DMI UUID and the subscription UUID are two separate UUIDs. (There is a setting about allowing duplicate DMI UUIDs for registration, but I’m not sure if that would help here.)

Hello, no, no errors seen, we are subscribing RHEL7, 8 or RHEL9 Clients only.

Hello, from what we have been trying, we observed, last one wins, so last one remains subscribed.
Important fact! We are subscribing Cloud VMs, within this Technology it is possible to have duplicate VM Hostnames in different resource groups/subscriptions. Is this planned to be supported?
Thanks!
Brgds, Jan

Hello, out solution for now, is we add a vmid to the hostname during subscription, but this is our workaround, not sure in the long term this is ok or good.
Regards
Jan