3

I'm not much of a Ruby guy, but found how to list the Ruby load path. Here's what it looks like for me

$ ruby -e 'puts $:'
/usr/lib/ruby/site_ruby/1.8
/usr/lib64/ruby/site_ruby/1.8
/usr/lib64/ruby/site_ruby/1.8/x86_64-linux
/usr/lib/ruby/site_ruby
/usr/lib64/ruby/site_ruby
/usr/lib64/site_ruby/1.8
/usr/lib64/site_ruby/1.8/x86_64-linux
/usr/lib64/site_ruby
/usr/lib/ruby/1.8
/usr/lib64/ruby/1.8
/usr/lib64/ruby/1.8/x86_64-linux

Some of these directories don't even exist, and frankly, I'd think custom fact .rb files would be best placed in a Puppet-ish location, like /etc/puppet/facts or similar.

Should I go with one of the existing load path locations or create a new one for purposes of Puppet?

  • 1
    Store them on the server as part of your modules, and let pluginsync put them where they need to go? – Zoredache Sep 11 '13 at 17:41
  • Oh wow, that was pretty straightforward, thanks for your help. – quickshiftin Sep 11 '13 at 17:52
7

The best practise is to put any facts and other plugins within modules on the puppet server. Then use the pluginsync feature on the client. This lets the puppet client put things in the appropriate location.

http://docs.puppetlabs.com/guides/plugins_in_modules.html

{modulepath}
└── {module}
    └── lib
        |── augeas
        │   └── lenses
        ├── facter
        └── puppet
            ├── parser
            │   └── functions
            ├── provider
            |   ├── exec
            |   ├── package
            |   └── etc... (any resource type)
            └── type

So a new fact might go into modules/examplemod/lib/facter/myfact.rb.

Since facter-1.7 there's also the possibility to have external facts, that can be deployed in /etc/facter/facts.d and can be written in any language.

  • @dawud, so external facts can't be pushed with pluginsync? – Zoredache Sep 11 '13 at 19:56
  • There's no need to. they are somewhat static resources that reside in every host you want to have a custom fact into. – dawud Sep 11 '13 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.