Re: [Puppet Users] Using custom facts in Puppet

2010-11-18 Thread Eric Sorenson
On Nov 18, 2010, at 5:23 PM, Ed Greenberg wrote:

> and also fileserver.conf:
> # cat /etc/puppet/fileserver.conf
> [files]
> path /var/lib/puppet/files
> allow *
> [plugins]
> path /var/lib/puppet/facts
> allow *
> 
> 
> 
> I put my fact file (plesk_version.rb) in the /var/lib/puppet/facts 
> directory. I also put a copy in the /var/lib/puppet/plugins directory.
plugins is a pseudo-path, like modules, so you don't need an explicit 
fileserver.conf entry for it. You should take that out, and instead make a 
lib/facter/ directory in one of your modules (I use the one that contains most 
of the manifest which *uses* the fact provided by the plugin) and drop 
plesk_version.rb in there. Restart puppetmasterd and you should be good to go.  
This is the approach described in 

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

HTH


 - Eric Sorenson - N37 17.255 W121 55.738  - http://twitter.com/ahpook  -

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Fwd: Re: [Puppet Users] Using custom facts in Puppet

2010-11-18 Thread Ed Greenberg
May I please ask again for some assistance with the question below? I 
hope somebody can help me.


Thanks,

Ed Greenberg

 Original Message 
Subject:Re: [Puppet Users] Using custom facts in Puppet
Date:   Tue, 16 Nov 2010 13:14:06 -0600
From:   Ed Greenberg 
Reply-To:   puppet-users@googlegroups.com
To: puppet-users@googlegroups.com



On 11/16/2010 09:33 AM, JWBoerma wrote:

 hello,

 I am trying to add a custum fact to my puppet module.
 I wrote and tested the facter script and it functions as I want it to.


I've got the same issue, trying to distribute a custom fact. I'd like to
return the version of Plesk Panel running on the client.

So I wrote and tested a little fact:

# cat plesk_version.rb
require 'facter'
Facter.add("plesk_version") do
  setcode do
%x{cat /usr/local/psa/version}.chomp
  end
end
r...@test10:~/lib/ruby/facter#

facter finds this on the client and it returns what I'm looking for.

I want to put this on the server and distribute it. My puppet clients
and puppetmaster server are 0.25.4.

On the puppetmaster I edited /etc/puppet/puppet.conf:
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
pluginpath=$vardir/lib/facter
pluginsync=true

[puppetmasterd]
#templatedir=/var/lib/puppet/templates
factsync=true
factpath=$vardir/facts

and also fileserver.conf:
# cat /etc/puppet/fileserver.conf
[files]
path /var/lib/puppet/files
allow *
[plugins]
path /var/lib/puppet/facts
allow *



I put my fact file (plesk_version.rb) in the /var/lib/puppet/facts
directory. I also put a copy in the /var/lib/puppet/plugins directory.

On my client, I ran the puppetd with this command:
# /usr/sbin/puppetd --no-daemonize --verbose --onetime  --pluginsync

I got this:
info: Retrieving plugin
err: /File[/var/lib/puppet/lib]: Failed to retrieve current state of
resource: Could not retrieve information from source(s)
puppet://xxx.x.net/plugins
notice: /File[/var/lib/puppet/lib/facter]: Dependency
file[/var/lib/puppet/lib] has 1 failures
warning: /File[/var/lib/puppet/lib/facter]: Skipping because of failed
dependencies

This seems to have changed some in 0.25.4, and googleing around has not
helped.

May I have a pointer to the correct process?

Thanks,
Ed Greenberg

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Using custom facts in Puppet

2010-11-16 Thread Ed Greenberg

Replying to my own post:

When run with --test and without --pluginsync, my puppetd returns this:
info: Caching catalog for test10.newhostingaccount.net
info: Applying configuration version '1289933909'
notice: Finished catalog run in 1.42 seconds

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Using custom facts in Puppet

2010-11-16 Thread Ed Greenberg

On 11/16/2010 09:33 AM, JWBoerma wrote:

hello,

I am trying to add a custum fact to my puppet module.
I wrote and tested the facter script and it functions as I want it to.
   
I've got the same issue, trying to distribute a custom fact. I'd like to 
return the version of Plesk Panel running on the client.


So I wrote and tested a little fact:

# cat plesk_version.rb
require 'facter'
Facter.add("plesk_version") do
  setcode do
%x{cat /usr/local/psa/version}.chomp
  end
end
r...@test10:~/lib/ruby/facter#

facter finds this on the client and it returns what I'm looking for.

I want to put this on the server and distribute it. My puppet clients 
and puppetmaster server are 0.25.4.


On the puppetmaster I edited /etc/puppet/puppet.conf:
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
pluginpath=$vardir/lib/facter
pluginsync=true

[puppetmasterd]
#templatedir=/var/lib/puppet/templates
factsync=true
factpath=$vardir/facts

and also fileserver.conf:
# cat /etc/puppet/fileserver.conf
[files]
path /var/lib/puppet/files
allow *
[plugins]
path /var/lib/puppet/facts
allow *



I put my fact file (plesk_version.rb) in the /var/lib/puppet/facts 
directory. I also put a copy in the /var/lib/puppet/plugins directory.


On my client, I ran the puppetd with this command:
# /usr/sbin/puppetd --no-daemonize --verbose --onetime  --pluginsync

I got this:
info: Retrieving plugin
err: /File[/var/lib/puppet/lib]: Failed to retrieve current state of 
resource: Could not retrieve information from source(s) 
puppet://xxx.x.net/plugins
notice: /File[/var/lib/puppet/lib/facter]: Dependency 
file[/var/lib/puppet/lib] has 1 failures
warning: /File[/var/lib/puppet/lib/facter]: Skipping because of failed 
dependencies


This seems to have changed some in 0.25.4, and googleing around has not 
helped.


May I have a pointer to the correct process?

Thanks,
Ed Greenberg

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



Re: [Puppet Users] Using custom facts in Puppet

2010-11-16 Thread Matthew Macdonald-Wallace
On Tue, 2010-11-16 at 07:33 -0800, JWBoerma wrote:
> Right now i am at a loss, since i cannot see what I'm doing wrong
> Does anyone have any experience with this?
> 
> thanx in advance.
> 

Can you send the output from the following command:

puppetd --test --verbose --no-daemonize


And also the source code of your custom fact?

Thanks,

Matt

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.



[Puppet Users] Using custom facts in Puppet

2010-11-16 Thread JWBoerma
hello,

I am trying to add a custum fact to my puppet module.
I wrote and tested the facter script and it functions as I want it to.

I am following the instructions to synchronise the facts/plugins as
written in
Adding_Facts and plugins_in_modules from the documentation, as in:

put factscript in /etc/puppet/modules//lib/facter

add these lines to puppet.conf:
[main]
pluginsync = true
factpath = $vardir/lib/facter

when I do a puppetd run on my client, where I want to use the module
with my homemade fact, I see the sync taking place, but that is all I
see happening.
The facts i want to use in the module stay empty, undefined actually.

sidenote: if in my current directory there exists a directory facter,
where my factscript has been added, then, when starting  puppetd -t
from there, the facts are added, which would mean, that the factscript
works.
It just seems, that Puppet doesn't use the directory to where the
script has been synced, despite the entry in puppet.conf

Right now i am at a loss, since i cannot see what I'm doing wrong
Does anyone have any experience with this?

thanx in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.