Provisioned host has empty puppet config

Problem:
Happy new year in advance, folks. I need a little bit of support please. Over the last days I have been setting up Foreman and Katello to manage my CentOS based home lab. I have two physical servers, one (discovery.mydomain) acting as an oVirt KVM host who also runs Foreman (foreman.mydomain) in a VM, and the other running a foreman-proxy with ISC DHCP and Bind (endeavour.mydomain. The remaining proxy capabilities are on foreman.mydomain itself, like TFTP, Puppet Master, Puppet CA, etc. I am provisioning VMs on oVirt through Foreman via PXE, DHCP and DNS are set fine. All works, but the new host does not get a proper puppet config. Probably as a new user, I am missing something obvious.

I have created a Subnet, with DHCP and Reverse DNS Proxies pointing to endeavour, all the other proxies are set to discovery, which is correct.
I have created a Domain with DNS proxy set to endeavour.
I have created a Product with Repositories for CentOS 7, an Activation Key, a Content View, a Host Group tying everything together.

I have manually configured the physical hosts (endeavour and discovery) as well as the Foreman VM (foreman) as puppet agents, and katello subscribers. Works…

Now, I am setting all the parameters in create host (most is populated through the Host Group and Subnet) and foreman happily provisions the new VM, PXE boot works, CentOS is installed, Katello is setup, DNS and DHCP are correct, just the puppet config is empty.

Expected outcome:
Having a working puppet agent config on the created host and seeing reports in foreman.

Foreman and Proxy versions:
All version 1.24.0

Distribution and version:
All installed via RPMs as described in the manual on CentOS 7 (x86_64)

Other relevant data:
I am using vanilla Kickstart templates to provision the host.

Adding the following infos from the provisioned host:

[root@ipa puppet]# puppet agent --version
2019-12-31 11:42:43.144156 WARN  puppetlabs.facter - locale environment variables were bad; continuing with LANG=C LC_ALL=C
6.11.1

[root@ipa puppet]# cat puppet.conf
# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://puppet.com/docs/puppet/latest/config_important_settings.html
# - https://puppet.com/docs/puppet/latest/config_about_settings.html
# - https://puppet.com/docs/puppet/latest/config_file_main.html
# - https://puppet.com/docs/puppet/latest/configuration.html

I don’t fully understand why this is necessary, but I solved the problem by setting the

Host Group > Parameters > Host Group Parameters > Add Parameter
name: enable-puppet6, boolean, true

I would have thought that this is set by default, if I set a puppet master in the New Host configuration.

Hello,

Maybe below walkthrough can help you to guide why this could be happening,

  1. The kickstart_default provisioning template,
  pm_set = @host.puppetmaster.empty? ? false : true
  proxy_uri = host_param('http-proxy') ? "http://#{host_param('http-proxy')}:#{host_param('http-proxy-port')}" : nil
  proxy_string = proxy_uri ? " --proxy=#{proxy_uri}" : ''
  puppet_enabled = pm_set || host_param_true?('force-puppet')

Here it needs to have the puppet_enabled set, which I think is enabled for your system.

  1. Going further, I see that it renders puppetlabs_repo when you have enable-puppetlabs* param for host,
<% if puppet_enabled %>
<% if host_param_true?('enable-puppetlabs-repo') || host_param_true?('enable-puppetlabs-puppet6-repo')|| host_param_true?('enable-puppetlabs-puppet5-repo') -%>
<%= snippet 'puppetlabs_repo' %>
<% end -%>
<%= snippet 'puppet_setup' %>
<% end -%>

If you dont have any enable-puppetlabs* repo then it jumps to puppet_setup snippet.

  1. In puppet_setup snippet I do see we use these enable-puppetlabs* params but we dont setup any repositries here,
aio_enabled = host_param_true?('enable-puppetlabs-puppet6-repo') || host_param_true?('enable-puppet6') || host_param_true?('enable-puppetlabs-puppet5-repo') || host_param_true?('enable-puppet5')
  1. I think below code block needs the fix,

If you see here you must need to have something in aio_enabled to make it run ‘elsif’ condition and choose ‘puppet-agent’ package. So yes, to avoid this issue,

I feel either we need to handle this if…else block differently which I think should be preferable or maybe make some puppet repo as default(maybe latest) ?

If we by default enable enable-puppet6 then there could be users who wants to install puppet5, but by default its installing puppet6 ?