refacter
Version information
This version is compatible with:
Start using this module
Add this module to your Puppetfile:
mod 'morpheu-refacter', '0.0.1'
Learn more about managing modules with a PuppetfileDocumentation
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
Types in this module release
The MIT License (MIT) Copyright (c) 2013 Stephen R. Scaffidi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.