Identify Hosts by Certname

Foreman and Proxy versions:
foreman : 1.16

Problem:

We use certnames extensively and the foreman service is being used in a multi-tenant environment.

But all the hosts are identified using the fqdn but I need to use certnames here, please suggest.

Another problem I observed related to the above is that puppetdb recognizes all the servers by certnames but when a host is deleted from Foreman, it does send “puppet node delete” command to puppetdb but with the “FQDN” so the node never gets deleted from puppetdb. so it is very critical as to how can ask foreman to identify hosts only by certname.

Any help is appreciated

Rakesh K.

Internally Foreman uses the certnames. They are often FQDNs but can also be UUIDs. At least, this is when processing reports and sending facts. Can you explain what you would expect to see?

Are you also using the puppetdb_foreman plugin to remove hosts? There may be a bug here where it’s using name rather than certname.

ekhol… Thanks for the reply.

Internally Foreman uses the certnames. They are often FQDNs but can also be UUIDs. At least, this is when processing reports and sending facts. Can you explain what you would expect to see?

The reason that I feel hosts are identified by FQDN is because teh forman “hosts” page shows “hostname” of each host and not the certname. Though I could get around this issue by using a plugin call “columnview

Are you also using the puppetdb_foreman plugin to remove hosts? There may be a bug here where it’s using name rather than certname.

Yes… I am using puppetdb_foreman to remove hosts. I do see the message "Deactivating node … " in the foreman logs but it comes with hostname and not the certname.

Also in puppetdb logs, I can see message for deactivating a node with “hostname”.

Please suggest how can I fix this ?

Can someone please suggest ??

This community forum is not a bug tracker so usually it means opening a bug report. Better is to provide a patch. I linked the relevant code. Untested, but I guess it’s something like:

https://github.com/theforeman/puppetdb_foreman/pull/63

@ekohl

Thanks a ton.

I could resolve the issue using the bugfix.

I will raise a bugreport on this.