Why is the 'Preseed default finish template' not installing the Puppet agent?

I’ve been able to provision CentOS & Ubuntu hosts on my new Foreman instance. Great!

I noticed that Foreman isn’t installing the Puppet agent, and I’m confused why.

I see the following code in the Preseed default finish template, but I don’t understand what this does. The Foreman Installer did install and configure a Puppet server, but it doesn’t seem to be getting picked up when I provision a host.

  # safemode renderer does not support unary negation
  pm_set = @host.puppetmaster.empty? ? false : true
  puppet_enabled = pm_set || host_param_true?('force-puppet')

And further down:

<% if puppet_enabled %>
<% if host_param_true?('enable-puppetlabs-pc1-repo') || host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-puppetlabs-puppet5-repo') -%>
<%= snippet 'puppetlabs_repo' %>
<% end -%>
<%= snippet 'puppet_setup' %>
<% end -%>

What am I missing?

It should do so.
So let’s check:

  • Is the finish template assigned to the operatingsystem (or hostgroup/environment)?
  • Is no user_data template used for provisioning (e.g. VMware image provisioning is using it)? Because this would disable finish step.
  • Is a puppetmaster assigned to the host?
  • Is the puppet parameter set for the puppet version you want (global, on operatingsystem, hostgroup or host)?
  • And with the latest version is all this done in the right context of organization and location?

I’m using PXEboot and a finish template.

I see what happened now. The “Puppet Master” value, viewable via the ‘All Hosts > Host > Edit > Host’ menu, had been de-assigned when I tried to reprovision the node.

Every time I provision a host, I need to manually populate the fields ‘Environment’, ‘Puppet Master’ and ‘Puppet CA’ under ‘All Hosts > Host > Edit > Host’. Is there a way to assign default values to all new hosts? Should I create a Host Group and assign the default values there?

Or, is it possible to set these globally, or to set a default for the Organization or Location? We only have one Organization & Location at the moment.

I didn’t see parameters for ‘Environment’, ‘Puppet Master’ and ‘Puppet CA’ within the locations shown at Hosts inherit their list of global parameters from the following locations, until I reached the Host Group. It looks like that might be the best place to leave the Parameters.

Looks like we did that on our old Foreman server also probably for the same reasons.

Yes, setting them to the Hostgroup and use it as a “template” (when using Compute Resource combined with a Compute Profile) creates the best user experience as you will only have to set values specific for the host, all others will be already filled out.

1 Like

And indeed, the use case I mentioned is mentioned in another thread at Rethinking host groups

As a “template” for a new host, which is used during provisioning to pre-define some or all of the attributes of the new host. These attributes are either copied to the host or retrieved from the host group during provisioning.