Allow the Foreman to add nodes with the same names

Problem: Foreman does not create nodes with the same hostnames. Names of the certificates are different, the Puppetserver signs them and applies the manifest successfully.

Expected outcome: How can i allow the Foreman to add nodes with the same names?

Foreman and Proxy versions: 2.0.1-1

Foreman and Proxy plugin versions:

Distribution and version: Ubuntu server 18.04

Other relevant data:

Hi @Sick_013 - welcome to the community :slight_smile:

Can I ask: why would you need to do this? What are you trying to achieve? knowing what you’re hoping to achieve might help the community better answer your question :slight_smile:

1 Like

My goal is to orchestrate about 2 thousand Windows computers, I do not administer them, these are external organizations, there is no domain controller or an adequate naming policy in general, it’s sad, but I can’t do anything about it, so I need to foreman create nodes with the same hostname, I would even be satisfied with the option in which instead of the hostname, uuid will be used

Internally Foreman uses a field called certname to track hosts, in particular when hosts come from Puppet. These must be unique. There is a setting use_uuid_for_certificates which is used for provisioning. That may help, but that’s a scenario I personally haven’t tried.

1 Like

I tried it, it doesn’t help, two test hosts just swap the facts with each other, in turn stubbornly staying the same host for Foreman

So, I solved this problem. In the /etc/puppetlabs/puppet/node.rb file on line 157, I replaced the value for hostname as follows:
It was: hostname = puppet_facts[‘values’][‘fqdn’] || certname
and now just like this: hostname = certname
Now hosts are added with the name of the certificate in the name field


That makes sense. Glad you got it to work. I’d caution you that the file is managed by the installer so that will replace your changes when it reruns.

I’d suggest to copy the file somewhere, doesn’t really matter where as long as the puppet user can execute it. Then run foreman-installer --puppet-server-external-nodes /path/to/my/copy. The installer will still manage /etc/puppetlabs/puppet/node.rb but configure Puppet to use your other script instead.