Puppet not applying classes

Problem:

When I create a new host, the Puppet master doesn’t seem to see that the host should receive those classes.

Expected outcome:

When the host runs puppet, it would apply the classes set in Foreman.

Foreman and Proxy versions:

1.20.1

Other relevant data:

When I run hammer host puppet-classes --host HOSTNAME, I see a list of puppet classes like this:

----|--------
ID  | NAME
----|--------
300 | python
----|--------

But when I run this on the puppetmaster (same node as the foreman service):

puppet master --compile HOSTNAME --environment ENVIRONMENT_NAME

From the output that I get, I see this:

"classes": [
  "settings"
]

Compared to my other Foreman (1.12.3) which shows a much bigger list of classes.

As a result, my Puppet client says it’s in sync, but doesn’t add a new report nor applies the classes that I expect.

What more detail can I give?

:thinking: I’m new here. I guess I can only edit for a short time after initially posting.

Anyway, I forgot to add a few details:

  • OS: Ubuntu 18.04 on both the Foreman and client VMs
  • Puppet version : 5.5.10
  • puppetserver version: 5.3.7

I just upgraded Foreman to 1.20.2 and am having the same issue.

Hi and welcome :slight_smile:

First off: Yes, posts can only be edited for some minutes to fix typos and things alike, because many people read posts via mail and those obviously can not be edited afterwards :wink:

Second, on your puppet master:
a) Did you install that via foreman-installer or is that a “by hand” installation / one that was already around?
b) Can you confirm that the relevant setting for Foreman ENC on your puppetmaster have been done? You see have the following settings on your master:

  • in /etc/puppetlabs/puppet/puppet.conf you should have “external_nodes = /etc/puppetlabs/puppet/node.rb” and “node_terminus = exec” in the master section and optionally “reports = foreman” in the main section
  • the file /etc/puppetlabs/puppet/foreman.yaml should be there and contain info on how to connect to your Foreman instance
1 Like

I used foreman-installer to setup foreman/puppetserver.

But the changes you mentioned in /etc/puppetlabs/puppet/puppet.conf is
exactly what I needed. THANKS!

I wonder why I didn’t have that setup as part of foreman-installer.

This is what I did w/ foreman-installer:

foreman-installer --foreman-admin-password "$PASSWORD" \
  --enable-foreman-plugin-templates \
  --enable-foreman-proxy \
  --foreman-proxy-tftp=true \
  --foreman-proxy-tftp-servername="$(hostname -f)" \
  --puppet-server-puppetserver-version=5.3.6 \
  --puppet-dns-alt-names="$(hostname),$(hostname -f)"

There must be some other option(s) to add that sets up the [master] section in /etc/puppetlabs/puppet/puppet.conf

Looks like I would need to add this:

--puppet-server-external-nodes

I just applied that, and it did exactly what I need.

Unfortunately, puppet agent ran shortly after that and wiped out the [master] section from /etc/puppetlabs/puppet/puppet.conf.

Debugging that now.

That was my puppet setup. I just had to add the necessary data for the new foreman.

Do these posts get closed?

Glad to hear you could figure it out :slight_smile:
Afaik, posts do not get closed. But you can mark an answer as the solution (there should be a checkbox button on each answer), so that others who stumble upon this thread know this is solved and what the solution was.

2 Likes

Thanks for the help.

For completeness, this is the hiera data I added for my node so Puppet wouldn’t wipe out the changes I want:

puppet::dns_alt_names:
  - "%{::hostname}"
  - "%{::fqdn}"
puppet::server: true
puppet::server_common_modules_path: []
puppet::server_foreman: false
puppet::server_jvm_min_heap_size: "2G"
puppet::server_jvm_max_heap_size: "2G"
puppet::server_version: "5.3.7-1bionic"