Forge Home

refacter

Puppet module to refresh facter and automatically reload on changes

14,504 downloads

14,504 latest version

4.5 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.0.1 (latest)
released Mar 14th 2016
This version is compatible with:

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'morpheu-refacter', '0.0.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add morpheu-refacter
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install morpheu-refacter --version 0.0.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: facter

Documentation

morpheu/refacter — version 0.0.1 Mar 14th 2016

puppet-refacter

Puppet provider to refresh facter and automatically reload if specified facts changed

Sometimes applying resources while running puppet changes the system in such a way that you need to re-run puppet to pick up new facts and finish making changes.

That sucks.

Sure, the "correct" answer is probably to use an ENC or Hiera or Magic Unicorn Dust or some other thing like that, but this puppet module solved the problem well enough for me.

Just configure whatever resource makes the "offending" system changes to notify this resource, and if the facts this resource is configured to check have changed, it will cause your puppet run to restart, reloading all facts, recompiling your manifests with the new facts, and restarting the application of the catalog.

For example:

# make sure various nfs disks are mounted - does this
# dynamically based on some sort of voodoo
class { "nfs::mounts": notify => Refacter["check-mount-points"] }

# we have a facter plugin that makes facts based on mounted filesystems
# so if they changed, we would normally have to re-run puppet. *ick*
# instead, we can use refacter...
refacter { "check-mount-points": patterns => [ "^mount_point" ] }

# if facts matching the given patterns changed, puppet will reload
# automatically. if nothing changed, it will continue as normal.

Please note: this has only been tested in local mode. If it doesn't work in client-server mode, patches welcome.

-- Stephen R. Scaffidi | stephen@scaffidi.net | Just Another (Perl|Python|Puppet) Hacker