[Puppet Users] Re: Using custom facts for the first time

paul matthews
Thu, 28 May 2009 12:07:45 -0000

Superb, thanks for that. I think my confusion was missing the point that you
need a specific module for facts pointed to by factpath  rather than tacking
on a plugins/facter directory under an existing module

2009/5/28 Saurabh Verma <nitw.saurabh@gmail.com>

>
> paul matthews wrote:
> > 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
> >
> This is to test your scripts , its nothing related to custom facts
> distribution per se.
> > 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
> >
> Did you configure you fileserver.conf  on puppetmaster for
"facts"
> module i.e did you add following in your fileserver.conf ?
>
> [facts]
>   path /var/lib/puppet/facts
>
> here "/var/lib/puppet/facts" is your path to "facts"
file server module
> on  puppetmaster where you will put your custom scripts that will sync
> to puppet client  and gets distributed to $factdest.  factpath is  the
> option to puppet which  tells where to look for the facts and by
> default  this is set as same as $factdest .
> > In short, as you can probably tell, I don''t really know what
I''m doing
> > so any help would be great
> >
> > Cheers
> > Paul
> > --
> > Paul Matthews
> > ----------------------------------------------------------------------
> >
> > >