configuring puppet to run custom facts

371 views
Skip to first unread message

Arnau Bria

unread,
Dec 1, 2008, 5:14:19 AM12/1/08
to puppet...@googlegroups.com
Hi,

I'm following
http://reductivelabs.com/trac/puppet/wiki/PluginsInModules in order to
use a custom fact.

My modules looks like:

# ls manifests/modules/network/
manifests plugins
# ls manifests/modules/network/plugins/facter/primaryint.rb
manifests/modules/network/plugins/facter/primaryint.rb

as is said in doc.

Then:

Turn on pluginsync and specify factpath, so that the facts dropped by pluginsync are loaded by Puppet:
[main]
pluginsync = true
factpath = $vardir/lib/facter

as it does not say if it's talking about master/client, I've set vars in
both hosts:
Master/client:

# grep . /etc/puppet/puppet.conf|grep -v "#"
[main]
vardir = /var/lib/puppet
logdir = /var/log/puppet
rundir = /var/run/puppet
ssldir = $vardir/ssl
pluginsync = true
factpath = $vardir/lib/facter
[puppetd]
classfile = $vardir/classes.txt
localconfig = $vardir/localconfig

Then I restart master and client but I can't see my own fact:

[root@td234 ~]# facter primaryint
[root@td234 ~]#

it's copied in client /var/lib/puppet/lib/facter/primaryint.rb

But, if I export RUBYLIB to /var/lib/puppet/lib/, facter sees it:
[root@td234 puppet]# export RUBYLIB=/var/lib/puppet/lib/
[root@td234 puppet]# facter primaryint
eth0


So, am I missing any conf step? any other variable is needed?
# rpm -qa|grep puppet
puppet-0.24.5-1.el4.x86_64

TIA,
Arnau

Mark Drayton

unread,
Dec 1, 2008, 5:19:19 PM12/1/08
to Puppet Users
Hi

On Dec 1, 10:14 am, Arnau Bria <arnaub...@pic.es> wrote:
> Then I restart master and client but I can't see my own fact:
>
> [root@td234 ~]# facter primaryint
> [root@td234 ~]#
>
> it's copied in client /var/lib/puppet/lib/facter/primaryint.rb
>
> But, if I export RUBYLIB to /var/lib/puppet/lib/, facter sees it:
> [root@td234 puppet]# export RUBYLIB=/var/lib/puppet/lib/
> [root@td234 puppet]# facter primaryint
> eth0

That's correct. When you run facter on the command line it doesn't
include facts in Puppet's factpath. I use Puppet to export the
following to all hosts so command-line facter picks up my facts:

[root@mgt303 ~]# cat /etc/profile.d/facter.sh
export FACTERLIB=/var/lib/puppet/facts
[root@mgt303 ~]# facter serial_tty # a custom fact
serial_tty => ttyS1

Have you tried using $primaryint in a Puppet manifest?

Mark

Arnau Bria

unread,
Dec 1, 2008, 5:39:32 PM12/1/08
to puppet...@googlegroups.com
On Mon, 1 Dec 2008 14:19:19 -0800 (PST)
Mark Drayton wrote:

>
> Hi
Hi Mark,



> That's correct. When you run facter on the command line it doesn't
> include facts in Puppet's factpath. I use Puppet to export the
> following to all hosts so command-line facter picks up my facts:
>
> [root@mgt303 ~]# cat /etc/profile.d/facter.sh
> export FACTERLIB=/var/lib/puppet/facts
> [root@mgt303 ~]# facter serial_tty # a custom fact
> serial_tty => ttyS1
>
> Have you tried using $primaryint in a Puppet manifest?

Nop, I didn't... I, wrongly, supposed facter had to shows custom
facts...
I'll try tomorrow. Thanks a lot.

> Mark
Arnau

Reply all
Reply to author
Forward
0 new messages