puppet-kmod icon indicating copy to clipboard operation
puppet-kmod copied to clipboard

Make facts export optional

Open deric opened this issue 3 years ago • 7 comments

  • Module version: 3.2.0

On a Debian installation I'm currently seeing almost 1k facts from kmod module

$ facter -y --puppet kmods | wc -l
973

Puppet 7 is preconfigured with soft limit for facts set to 2048.

$ facter -y | wc -l
1380

Combining default puppet facts with kmod facts can easily exceed this soft limit. Of course the limit can be increased, but I guess the main reason is performance. Currently I find little usage kmod facts. E.g. would it be possible to export only managed modules?

deric avatar Aug 03 '22 10:08 deric

wanted to make an issue for this, but found it :)

yes puppet is now complaining because of too many facts. this module seems to be the culprit (for me)

please make it optional as not really needing it, by default.

squaricdot avatar Mar 03 '23 16:03 squaricdot

Hi and thanks for your work on this module :)

We also encountered this issue here:

Warning: The current total number of facts: 2121 exceeds the number of facts limit: 2048

I agree with the previous messages, it would be really nice to be able to restrict facts to managed modules, or even completely disable these facts with a parameter.

dekonnection avatar Mar 10 '23 16:03 dekonnection

Facts can not be enabled/disabled using parameters. Once you include a module with a custom fact it will get deployed to all Puppet agents using plugin sync. That is not something you can turn off selectively. Generally speaking facts don't know what's managed and unmanaged in Puppet so only doing modules that are part of Puppet isn't really possible either.

There are a few options.

One you could increase the number of facts your system allows: https://www.puppet.com/docs/puppet/7/configuration.html#number-of-facts-soft-limit

Another option is to attempt to disable the facts on the Puppet agent host using block list: https://www.puppet.com/docs/puppet/7/configuring_facter.html#configuring_facter-facter-conf-facts

treydock avatar Mar 13 '23 13:03 treydock

Facts can not be enabled/disabled using parameters.

@treydock Yes not directly, but facter code is processed locally and you can read configuration stored e.g. in a local config file.

deric avatar Mar 13 '23 13:03 deric

Yes @deric , that's exactly what I meant: configuring the fact using a local config file 👍

dekonnection avatar Mar 13 '23 14:03 dekonnection

Idea:

  1. Fact: check if a flag/config file exists and only process the kmod facts if the file is available.
  2. The kmod module needs a parameter (default false) to set the flag/config file only if the parameter is set to true.

This means that the kmod facts will be available on a second puppet agent run only.

tuxmea avatar Mar 13 '23 16:03 tuxmea

I've used the "full" fact twice since I wrote it. Once to fine the systems using dropped kmods for migrating to EL8 and once for the same thing for EL9. I'm going to do it again once the EL10 hardware list is finalized.

I'd be totally fine with there being a flag/file/thing I need to deploy to get the whole list of every module and paramter with the default being a smaller list.

jcpunk avatar Dec 12 '24 05:12 jcpunk