Puppet Server now uses JSON for facts instead of YAML, but Foreman is not importing the information

Problem:
Puppet Server now uses JSON for facts instead of YAML, but Foreman is not importing the information.

In Puppetserver 6.20.0 support was added for a JSON fact cache and
Puppetserver 7 defaults to JSON. JSON is faster than YAML and doesn’t
have quirks like the mac address which is parsed different depending on
Ruby versions.

The JSON files are updated and located in

/opt/puppetlabs/server/data/puppetserver/server_data/facts

The old directory for the YAML files is

/opt/puppetlabs/server/data/puppetserver/yaml/facts

The YAML files are no longer updated. Foreman does not import the JSON data into the database. Reports are working fine, just not Facts.

Any ideas?

Expected outcome:

Facts get imported into the Postgres database “foreman”

Foreman and Proxy versions:

Foreman 1.22.2
Puppet Server 7.6.0

Distribution and version:

CentOS Linux release 7.9.2009 (Core)

Other relevant data:

Wow Foreman 1.22.2 is really old. According to this threat, it looks like puppet 7 support was added in Foreman 3.0

Yeah, I just realized how old it was. It’s been working fine except recording Fact data, but looks our version might not support importing Fact data in JSON format, though not sure.

It might be time to update Foreman on this box. Have you ever tried to upgrade Foreman in place? Any good articles you would recommend?

So long as you made any changes using foreman-installer it’s dead easy, just follow the upgrade steps in the next version up, so 1.23, then rinse and repeat until you’re up to a supported version.

Sadly you have to take every step.

If you’ve made changes outside of foreman-installer you can run it with --noop --verbose --dont-save-answers to generate a diff and work out what changes you’ve made and then work out what the correct switches were foreman-installer --full-help with show you all the parameters you can pass.

Hope that helps.

Having this issue with latest foreman 3.2.0. Foreman does not import the JSON data into the database. Reports are working fine.

puppetserver-7.7.0-1
foreman-3.2.0-1

Does this config work for anyone?

It seems you’re not the only one fighting this Foreman no longer shows Puppet Facts for new agents

Check your /etc/puppetlabs/puppet/foreman.yaml and see what your fact_extension line says. Perhaps it would help to change it from yaml to json. Foreman is looking at the facts dir and searches for the files with a given extension. Let us know if it helps.

3 Likes

Yes, that did the trick, I had to add the below line and restart foreman and now I can see all facts in foreman. Thanks.

[root@ ~]# grep json /etc/puppetlabs/puppet/foreman.yaml
:fact_extension: json
[root@ ~]#

1 Like