Register host does not use puppet settings from host group

Ah, sorry @gvde. There we have misunderstood us completely. I am using the default Linux host_init_config default which calls the original puppet_setup and puppet.conf snippets. No modifications to the Provisioning Telmplates have been made.

The issue is the same as stated by the OP, just on a fresh installation of Foreman/Katello.

If a Host Object exists for the relevant client which has the Puppet Variables set, it gets of course rendered correctly. The issue occurs when you register a new host, using the global registration template (Hosts / Register New Host).

The reason is that the Puppet Settings are not inherited from the Host Group during registration.

  1. Create a Host Group
  2. Define Puppet Proxy, Puppet CA and Environment on the Host Group
  3. Use the global registration template to register a new host which is not present on FM yet (Hosts / Register new Host) using the generated curl command piped to bash.

The result is as described above.

Well, it works for me if I select one of my existing host groups. I do, however, have also content set up, i.e. lifecycle environment, content view, content source, as well as the operating system. Do you see any errors when running the registration script?

As the curl command only downloads a shell script, you can just as well do the steps in the script step by step.

Or at least take a closer look into the generated host_init script: use the generated curl command and write the script into a file, i.e. removing the | bash at the end and redirect the output into a script file.

curl -sS 'https://foreman....' > register.sh

Edit the script file register.sh to write the host_init script into a file, too, and comment out the cleanup. The last few lines would look something like this then:

    register_katello_host > register-katello-host.sh
else
    register_host > register-host.sh
fi

# cleanup_and_exit

Now run the register script. For better tracing it may be useful to run bash with -x:

# bash -x register.sh

At the end of the script it should write the host init script into register-katello-host.sh. That would be interesting to see. Also check carefully for errors during the script.

Yes, that’s exactly what I have done for debugging. I can see that the puppet variables are not rendered correctly. Can you confirm, you are running the latest FM version on a fresh installation? I am not using content view, just Library.

Just a side note:
host_puppet_ca_server and host_puppet_server are rendered if set as Global Variables, but host_puppet_environment is not.

It’s working fine for me on 3.5/4.7. But it’s not a fresh installation.

I suggest you open a new topic for this. It doesn’t seem to be the same issue as the original issue and it doesn’t help to revive a thread that is two years old.

You also have to give more details and be more precise. Before you wrote you have only set “Puppet Proxy, Puppet CA and Environment on the Host Group” but now you mention you have set Library environment as well. Or not? A host group has a lot of configuration options… I have asked to post the initial config script you get, but you don’t. I have asked for (error) messages during the script execution. You don’t post anything about it.

It make it hard to understand what you really do and what happens.

As I wrote: it’s working for and so it does for others. Please open a new topic and start with a complete and detailed description of your installation and the issue.

As you requested, I have created a new issue: Bug #36207: Host Group Puppet Settings are not inherited - Foreman

The output of the rendered Linux host_init_config default template, generated as you have been describing earlier, has been attached to the issue.

Library is default, so there has been nothing configured differently then mentioned earlier.

I have also checked the behavior with a content view / lifecycle as you described in your setup, and it’s the same.

Of course, the Host object has to be deleted first from Foreman. If the Host object exists and has a valid Puppet configuration set, it works, because nothing has to be inherited.