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 -%>
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.
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.
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.