Do I need to set "storeconfigs" and "storeconfigs_backend" for Puppet server installed by Foreman?


I installed Foreman which also installs Puppet server on the same system.

I have some puppet code developed previously for Puppet Enterprise (which had puppetdb installed with it). When I ran the code with Foreman I got the error message:

puppetserver/puppetserver.log:2019-06-27 14:31:31,012 WARN  [qtp881501137-16588] [puppetserver] Puppet You cannot collect exported resources without storeconfigs being set; the export is ignored (file: /etc/puppetlabs/code/environments/qa/modules/hosts/manifests/init.pp, line: 124, column: 5)

The line causing the trouble in the init.pp of Puppet host module there is:

@@host { $::fqdn:

According to Foreman document I don’t have to set storeconfigs. But I don’t know how to get around the problem in Foreman.

If I set “storeconfigs=true” then it asks about set “storeconfigs_backend=puppetdb”. So I installed puppetdb and configured the puppet server properly, then above error message was gone and correct catalog was applied. But on Foreman admin UI it seems it is not aware of the nodes that have been sync-ed, it will reports all nodes are out of sync even I manually run “puppet agent -t” on the node and everything is fine.

Expected outcome:
The code should compile with “storeconfigs” warning.
Foreman and Proxy versions:
Foreman and Proxy plugin versions:
Other relevant data:

puppet server log

uppetserver.log:2019-06-27 17:06:57,540 WARN  [qtp357263431-96] [puppetserver] Puppet You cannot collect exported resources without storeconfigs being set; the export is ignored (file: /etc/puppetlabs/code/environments/production/modules/hosts/manifests/init.pp, line: 124, column: 5)

Foreman is only working as report handler and ENC, but not as stored configs backend required for exported resources. So you need to setup PuppetDB in addition which is easy by using the corresponding Puppet module. Afterwards add the PuppetDB plugin to Foreman, so Foreman can delete records from PuppetDB during deprovisioning.

An alternative to exported resources would be PuppetDB lookup which also requires PuppetDB or the Puppet function provided by foreman. Both option can significantly increase speed of Puppet runs especially on the host collecting the exported resources, but require adjustment of the Puppet code.

And to address the question about synced state, this has nothing to do with PuppetDB and is only about reporting back from a Puppet run.

I followed Dirk’s advice (thanks!). It took me sometime to fix the problem… Here is what I did:

  1. Install puppetdb and configure the puppet server accordingly.
    Since puppetdb is using postgresql also, you need to create another postgresql cluster (hint: use pg_ctlcluster) to distinguish it from “main” cluster which was created for Foreman during Foreman installation.

  2. Configure puppet server to set “storeconfigures = true”. You don’t need to set “storeconfigs_backend”. To set this in “puppet.conf” for pupper server:
    storeconfigs = true
    reports = log, foreman

  3. Install Foreman puppetdb plugin. Foreman manual has the instructions.

  4. Configure Foreman UI “Administer->Settings->puppetdb” for “puppetdb_address” and turn on “puppetdb_enabled”.

After that restart each service and there is no error anymore and the Foreman Monitor shows the correct agent status.