Foreman vs. puppetlabs::puppet_agent: `he puppet_agent module does not support pre-Puppet 4 upgrades`

Problem:

I’m using Foreman 1.22 to provision Ubuntu 18.04 hosts.

I also want to maintain the Puppet version across all my nodes, including the Puppet master. In a base class, I simply have the following:

class profile::puppet::agent (                                                                                               
  $manage_puppet = true,                                                                                                     
) {                                                                                                                          
                                                                                                                             
  if $manage_puppet {                                                                                                        
                                                                                                                             
    class { '::puppet_agent':                                                                                                
      collection => 'puppet5',                                                                                               
    }                                                                                                                        
  }                                                                                                                          
                                                                                                                             
} 

When I run puppet agent --test on the nodes, puppet complains about the Puppet version installed by Foreman vs. the one expected by puppetlabs::puppet_agent itself:

web1 # puppet agent --test
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, The puppet_agent module does not support pre-Puppet 4 upgrades. (file: /etc/puppetlabs/code/environments/production/modules/puppet_agent/manifests/init.pp, line: 115, column: 5) on node web1.example.org
web1 #

I believe this is happening because Foreman installs Puppet from the Ubuntu repo, while Puppet expects something different-- an AIO install, perhaps?

Expected outcome:

I was expecting the module to upgrade the Puppet agent to the current Puppet5 version.

Foreman and Proxy versions:

Foreman 1.22.1.

Foreman and Proxy plugin versions:

n/a

Other relevant data:

n/a

So, it turns out what’s happening here is that Foreman installs the default version of Puppet from the Ubuntu repository. But that’s incompatible with puppetlabs/puppet_agent. I did file a ticket with the puppetlabs-puppet_agent authors about this incompatability.

It would also be nice if Foreman installed Puppet on Ubuntu 18.04 following the official directions. Does anyone have code that does that?

The provisioning templates have parameters to enable the Puppetlabs repositories. That’s probably the easiest way.

Thanks. I now see the enable-puppetlabs-repo parameter in templates like Preseed default finish.

I imagine that one of the best places to add this is in the Host Group.

Operating System is also a good place since you’ll likely not want to use the OS packaged Puppet anywhere for that Ubuntu version.

1 Like

Just for others who find this error, this still isn’t working in Foreman 1.24 and Ubuntu 18.04.

In the Finish template on my hosts, I notice that Foreman uses an old URL which is a 404:

wget -O /tmp/puppetlabs-release-bionic.deb https://apt.puppet.com/puppetlabs-release-bionic.deb

The correct URL would be something like http://apt.puppetlabs.com/puppet-release-bionic.deb or http://apt.puppetlabs.com/puppet5-release-bionic.deb

I haven’t checked to see if this was fixed in a newer version of Foreman due to other priorities. If you see that it is, please update this thread.