Puppet provider to refresh facter and automatically reload if specified facts changed
Ruby Roff
Pull request Compare This branch is 26 commits ahead of hajee:master.
Permalink
Failed to load latest commit information.
.tmp
gemfiles
lib/puppet
spec
.gitignore
.rubocop.yml
.travis.yml
CHANGELOG.md
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
metadata.json

README.md

Build Status

puppet-refacter

Puppet type and 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.

This breaks the idempotency convention, and is really confusing with master less puppet deployments

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.

Limitations

Currently it only works idemptoently with puppet apply, not puppet agent. For Puppet agent deployments, you have to run Puppet twice to see the new fact values like before