Hi, I have been trying to make facts work via modules (According to http://reductivelabs.com/trac/puppet/wiki/PluginsInModules) but its simply not working. I have been getting help via #puppet (And that has been a big help) but still no luck Data: Master+server running Debian with puppet version 0.24.5-3 puppetteer:/etc/puppet/modules/mysqlserver# find . . ./manifests ./manifests/init.pp ./plugins ./plugins/facter ./plugins/facter/mysqlversion.rb ./files puppetteer:/etc/puppet/modules/mysqlserver# cat plugins/facter/ mysqlversion.rb require ''facter'' Facter.add("mysqlversion") do setcode do %x{mysql -V}.chomp end end and in my manifest I use case $mysqlversion { default: { err(" mysqlversion is $mysqlversion") err(" mysqlserver is $mysqlserver") } } but the strings $mysqlversion and $mysqlserver is always empty. I run my puppetmaster with puppetmasterd --no-daemonize -d --verbose and the client with puppetd --no-daemonize -d -o --verbose now when I run this I get the debug message: .... debug: importing ''/etc/puppet/modules/mysqlserver/manifests/init.pp'' info: Autoloaded module mysqlserver err: Scope(Class[mysqlserver]): mysqlversion is err: Scope(Class[mysqlserver]): mysqlserver is ... but if I add this on the client # mkdir -p ~/lib/ruby/facter ; export RUBYLIB=~/lib/ruby # cd ~/lib/ruby/facter and then add the same .rb script but with Facter.add("mysqlserver") and then run the master + client again I actually get the mysqlversion filled in $mysqlserver .. so my facter is working but to me it seems that its not beein distributed to the client or a path is missing my server configuration: [main] logdir=/var/log/puppet vardir=/var/lib/puppet ssldir=/var/lib/puppet/ssl rundir=/var/run/puppet factpath=$vardir/lib/facter pluginsync=true [puppetmasterd] templatedir=/var/lib/puppet/templates my client configuration: [main] logdir=/var/log/puppet vardir=/var/lib/puppet ssldir=/var/lib/puppet/ssl rundir=/var/run/puppet factpath=$vardir/lib/facter pluginsync=true server=puppetteer.netgroup.dk factsignore=.svn CVS *.*~ [puppetmasterd] templatedir=/var/lib/puppet/templates anyone can tell me I''m doing wrong ? Best regards Kim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Kim Gert Nielsen
2009-Oct-14 19:12 UTC
[Puppet Users] Re: Problem distributing facts/or debugging
Hi, can anyone using facts verify that what I''m doing should be correct ? On Oct 13, 2009, at 8:13 PM, desdic wrote:> > Hi, > > I have been trying to make facts work via modules (According to > http://reductivelabs.com/trac/puppet/wiki/PluginsInModules) but its > simply not working. I have been getting help via #puppet (And that has > been a big help) but still no luck > > Data: > > Master+server running Debian with puppet version 0.24.5-3 > > puppetteer:/etc/puppet/modules/mysqlserver# find . > . > ./manifests > ./manifests/init.pp > ./plugins > ./plugins/facter > ./plugins/facter/mysqlversion.rb > ./files > > puppetteer:/etc/puppet/modules/mysqlserver# cat plugins/facter/ > mysqlversion.rb > require ''facter'' > > Facter.add("mysqlversion") do > setcode do > %x{mysql -V}.chomp > end > end > > and in my manifest I use > > case $mysqlversion { > default: { > err(" mysqlversion is $mysqlversion") > err(" mysqlserver is $mysqlserver") > } > } > > but the strings $mysqlversion and $mysqlserver is always empty. I run > my puppetmaster with puppetmasterd --no-daemonize -d --verbose and the > client with puppetd --no-daemonize -d -o --verbose > > now when I run this I get the debug message: > > .... > debug: importing ''/etc/puppet/modules/mysqlserver/manifests/init.pp'' > info: Autoloaded module mysqlserver > err: Scope(Class[mysqlserver]): mysqlversion is > err: Scope(Class[mysqlserver]): mysqlserver is > ... > > but if I add this on the client > > # mkdir -p ~/lib/ruby/facter ; export RUBYLIB=~/lib/ruby > # cd ~/lib/ruby/facter > > and then add the same .rb script but with Facter.add("mysqlserver") > and then run the master + client again I actually get the mysqlversion > filled in $mysqlserver .. so my facter is working but to me it seems > that its not beein distributed to the client or a path is missing > > my server configuration: > [main] > logdir=/var/log/puppet > vardir=/var/lib/puppet > ssldir=/var/lib/puppet/ssl > rundir=/var/run/puppet > factpath=$vardir/lib/facter > pluginsync=true > > [puppetmasterd] > templatedir=/var/lib/puppet/templates > > my client configuration: > [main] > logdir=/var/log/puppet > vardir=/var/lib/puppet > ssldir=/var/lib/puppet/ssl > rundir=/var/run/puppet > factpath=$vardir/lib/facter > pluginsync=true > server=puppetteer.netgroup.dk > factsignore=.svn CVS *.*~ > > [puppetmasterd] > templatedir=/var/lib/puppet/templates > > anyone can tell me I''m doing wrong ? > > Best regards > Kim > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Nigel Kersten
2009-Oct-14 19:45 UTC
[Puppet Users] Re: Problem distributing facts/or debugging
On Wed, Oct 14, 2009 at 12:12 PM, Kim Gert Nielsen <kgn@netgroup.dk> wrote:> > Hi, > > can anyone using facts verify that what I''m doing should be correct ?Does this shed light on things? http://reductivelabs.com/trac/puppet/wiki/UsingMultipleEnvironments scroll to: "Plugins and Facts"> > On Oct 13, 2009, at 8:13 PM, desdic wrote: > >> >> Hi, >> >> I have been trying to make facts work via modules (According to >> http://reductivelabs.com/trac/puppet/wiki/PluginsInModules) but its >> simply not working. I have been getting help via #puppet (And that has >> been a big help) but still no luck >> >> Data: >> >> Master+server running Debian with puppet version 0.24.5-3 >> >> puppetteer:/etc/puppet/modules/mysqlserver# find . >> . >> ./manifests >> ./manifests/init.pp >> ./plugins >> ./plugins/facter >> ./plugins/facter/mysqlversion.rb >> ./files >> >> puppetteer:/etc/puppet/modules/mysqlserver# cat plugins/facter/ >> mysqlversion.rb >> require ''facter'' >> >> Facter.add("mysqlversion") do >> setcode do >> %x{mysql -V}.chomp >> end >> end >> >> and in my manifest I use >> >> case $mysqlversion { >> default: { >> err(" mysqlversion is $mysqlversion") >> err(" mysqlserver is $mysqlserver") >> } >> } >> >> but the strings $mysqlversion and $mysqlserver is always empty. I run >> my puppetmaster with puppetmasterd --no-daemonize -d --verbose and the >> client with puppetd --no-daemonize -d -o --verbose >> >> now when I run this I get the debug message: >> >> .... >> debug: importing ''/etc/puppet/modules/mysqlserver/manifests/init.pp'' >> info: Autoloaded module mysqlserver >> err: Scope(Class[mysqlserver]): mysqlversion is >> err: Scope(Class[mysqlserver]): mysqlserver is >> ... >> >> but if I add this on the client >> >> # mkdir -p ~/lib/ruby/facter ; export RUBYLIB=~/lib/ruby >> # cd ~/lib/ruby/facter >> >> and then add the same .rb script but with Facter.add("mysqlserver") >> and then run the master + client again I actually get the mysqlversion >> filled in $mysqlserver .. so my facter is working but to me it seems >> that its not beein distributed to the client or a path is missing >> >> my server configuration: >> [main] >> logdir=/var/log/puppet >> vardir=/var/lib/puppet >> ssldir=/var/lib/puppet/ssl >> rundir=/var/run/puppet >> factpath=$vardir/lib/facter >> pluginsync=true >> >> [puppetmasterd] >> templatedir=/var/lib/puppet/templates >> >> my client configuration: >> [main] >> logdir=/var/log/puppet >> vardir=/var/lib/puppet >> ssldir=/var/lib/puppet/ssl >> rundir=/var/run/puppet >> factpath=$vardir/lib/facter >> pluginsync=true >> server=puppetteer.netgroup.dk >> factsignore=.svn CVS *.*~ >> >> [puppetmasterd] >> templatedir=/var/lib/puppet/templates >> >> anyone can tell me I''m doing wrong ? >> >> Best regards >> Kim >> >> > > > > > >-- nigel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Kim Gert Nielsen
2009-Oct-15 10:46 UTC
[Puppet Users] Re: Problem distributing facts/or debugging
no not really but I found the problem .. the version I have a bug when using allow * in fileserver.conf and then I changed that to the IP it worked :) but the other article is quite interesting because I was going to use the enviroment for customers .. so instead of development I would use customer01 Best regards Kim On Oct 14, 2009, at 9:45 PM, Nigel Kersten wrote:> > On Wed, Oct 14, 2009 at 12:12 PM, Kim Gert Nielsen <kgn@netgroup.dk> > wrote: >> >> Hi, >> >> can anyone using facts verify that what I''m doing should be correct ? > > Does this shed light on things? > > http://reductivelabs.com/trac/puppet/wiki/UsingMultipleEnvironments > > scroll to: "Plugins and Facts" > > > >> >> On Oct 13, 2009, at 8:13 PM, desdic wrote: >> >>> >>> Hi, >>> >>> I have been trying to make facts work via modules (According to >>> http://reductivelabs.com/trac/puppet/wiki/PluginsInModules) but its >>> simply not working. I have been getting help via #puppet (And that >>> has >>> been a big help) but still no luck >>> >>> Data: >>> >>> Master+server running Debian with puppet version 0.24.5-3 >>> >>> puppetteer:/etc/puppet/modules/mysqlserver# find . >>> . >>> ./manifests >>> ./manifests/init.pp >>> ./plugins >>> ./plugins/facter >>> ./plugins/facter/mysqlversion.rb >>> ./files >>> >>> puppetteer:/etc/puppet/modules/mysqlserver# cat plugins/facter/ >>> mysqlversion.rb >>> require ''facter'' >>> >>> Facter.add("mysqlversion") do >>> setcode do >>> %x{mysql -V}.chomp >>> end >>> end >>> >>> and in my manifest I use >>> >>> case $mysqlversion { >>> default: { >>> err(" mysqlversion is $mysqlversion") >>> err(" mysqlserver is $mysqlserver") >>> } >>> } >>> >>> but the strings $mysqlversion and $mysqlserver is always empty. I >>> run >>> my puppetmaster with puppetmasterd --no-daemonize -d --verbose and >>> the >>> client with puppetd --no-daemonize -d -o --verbose >>> >>> now when I run this I get the debug message: >>> >>> .... >>> debug: importing ''/etc/puppet/modules/mysqlserver/manifests/init.pp'' >>> info: Autoloaded module mysqlserver >>> err: Scope(Class[mysqlserver]): mysqlversion is >>> err: Scope(Class[mysqlserver]): mysqlserver is >>> ... >>> >>> but if I add this on the client >>> >>> # mkdir -p ~/lib/ruby/facter ; export RUBYLIB=~/lib/ruby >>> # cd ~/lib/ruby/facter >>> >>> and then add the same .rb script but with Facter.add("mysqlserver") >>> and then run the master + client again I actually get the >>> mysqlversion >>> filled in $mysqlserver .. so my facter is working but to me it seems >>> that its not beein distributed to the client or a path is missing >>> >>> my server configuration: >>> [main] >>> logdir=/var/log/puppet >>> vardir=/var/lib/puppet >>> ssldir=/var/lib/puppet/ssl >>> rundir=/var/run/puppet >>> factpath=$vardir/lib/facter >>> pluginsync=true >>> >>> [puppetmasterd] >>> templatedir=/var/lib/puppet/templates >>> >>> my client configuration: >>> [main] >>> logdir=/var/log/puppet >>> vardir=/var/lib/puppet >>> ssldir=/var/lib/puppet/ssl >>> rundir=/var/run/puppet >>> factpath=$vardir/lib/facter >>> pluginsync=true >>> server=puppetteer.netgroup.dk >>> factsignore=.svn CVS *.*~ >>> >>> [puppetmasterd] >>> templatedir=/var/lib/puppet/templates >>> >>> anyone can tell me I''m doing wrong ? >>> >>> Best regards >>> Kim >>> >>>> >> >> >>> >> > > > > -- > nigel > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Marc Fournier
2009-Oct-15 11:36 UTC
[Puppet Users] Re: Problem distributing facts/or debugging
> but the other article is quite interesting because I > was going to use the enviroment for customers .. so instead of > development I would use customer01Beware that distributing facts and libs in modules doesn''t work from environments before 0.25. Marc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Kim Gert Nielsen
2009-Oct-15 11:43 UTC
[Puppet Users] Re: Problem distributing facts/or debugging
hmm then the debian version must be backported because it works in 0.24.5-3 :) On Oct 15, 2009, at 1:36 PM, Marc Fournier wrote:> >> but the other article is quite interesting because I >> was going to use the enviroment for customers .. so instead of >> development I would use customer01 > > Beware that distributing facts and libs in modules doesn''t work from > environments before 0.25. > > Marc > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Peter Meier
2009-Oct-15 12:05 UTC
[Puppet Users] Re: Problem distributing facts/or debugging
> hmm then the debian version must be backported because it works in > 0.24.5-3 :)it works if you define standard (non-per-environment) paths as well, but puppet will then take the facts and plugins from this path and not actually from the one in the environments. cheers pete --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Thomas Bellman
2009-Oct-15 12:22 UTC
[Puppet Users] Problem distributing facts/or debugging
Kim Gert Nielsen wrote:> hmm then the debian version must be backported because it works in > 0.24.5-3 :) > > On Oct 15, 2009, at 1:36 PM, Marc Fournier wrote: > >> Beware that distributing facts and libs in modules doesn''t work from >> environments before 0.25.It may be more correct to say that per-environment facts don''t work *reliably* before 0.25. The client would get its facts not from the environment it request its manifest from, but from the environment it used the *previous* time it connected to the Puppet-master. And for a new client, or after a restart of the master, they would get their facts from the default environment. So, this would happen: [Start puppetmasterd] # puppetd --environment=devel Gets facts from production, because that''s what the default environment is # puppetd --environment=devel Now gets facts from devel, because that''s what it asked for in the previous run # puppetd --environment=production Still gets facts from devel # puppetd --environment=devel Facts from production [Restart puppetmasterd] # puppetd --environment=devel Facts from production, because that''s what the default environment is The problem before 0.25 was that the client only told the master about the wanted environment when it requested *manifests*, not when it downloaded files (using the puppet: URL scheme), so the master guessed what environment it used based on what it wanted the last time it asked for its manifests. And a typical run of puppetd would do this: 1. Download custom facts (and resource types) using the puppet: protocol (and thus without saying what environment it wanted) 2. Request compiled manifests for ENVIRONMENT. 3. Download files specified by the ''file'' type using the puppet: protocol. which obviously fails. And note that while per-environment custom facts is supposed to work in 0.25 (I haven''t tried it myself, though), you still cannot have custom resource types or custom functions per environment. /Bellman --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---