[Puppet Users] Using custom facts for the first time

paul matthews
Thu, 28 May 2009 10:10:13 -0000

Hi,
I''m attempting to create a custom fact to tell me the day of the week (
to
be used as a file suffix for vmware snapshots). I''ve followed the wiki
which
advises deploying facts via modules for releases >0.24. As I understand this
means :-

   1. creating a plugins/facter directory under an existing (or new module)
   2. dropping in your ruby based facter (.rb) script to that directory
   3.  adding the following to /etc/puppet/puppet.conf on the master

[main]
pluginsync = true
factpath = $vardir/lib/facter

Aftre this things get a bit hazy for me. The Adding Facts wiki page
http://reductivelabs.com/trac/puppet/wiki/AddingFacts talks about :-

>> Create a directory called facter/ somewhere, and set the environment
variable $RUBYLIB to its parent. You can then run facter, and it will import
your code:

>> host:~$ mkdir -p ~/lib/ruby/facter ; export RUBYLIB=~/lib/ruby
>> host:/tmp$ cp /path/to/hardware_platform.rb $RUBYLIB/facter
>> host:/tmp$ facter hardware_platform
>> SUNW,Sun-Blade-1500

Do I need to do this or is this deprecated with modules? Also, what does the
factpath do? Does that need to exist on master and clients. The final step
is to run puppetd with --factsync on (I guess) a client. On mine it returns
an error

# puppetd -vt --factsync
info: Retrieving facts
err: /File[/var/lib/puppet/facts]: Failed to generate additional resources
during transaction: Fileserver module ''facts'' not mounted

In short, as you can probably tell, I don''t really know what
I''m doing so
any help would be great

Cheers
Paul