Hi all, I''m experiencing some difficulty getting custom facts to run. I''ve installed them on the puppetmaster in: ${modulepath}/${module}/lib/facter/*.rb and from there they appear to be copied properly onto the clients, where they end up in: /var/lib/puppet/lib/facter/*.rb On all clients, in puppet.log, the output of puppet-agent mentions "Loading facts" and seems to do the right thing. However, running facter on the client, the facts do not show up, even with --debug and with sudo. On the puppetmaster, they do show up in facter output as expected. So what''s going wrong? I''m running CentOS 6 and Puppet 2.6.6. Thanks, Jonathan -- 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.
On Mon, Oct 03, 2011 at 11:00:18AM +0100, Jonathan Gazeley wrote:> Hi all, > > I''m experiencing some difficulty getting custom facts to run. I''ve > installed them on the puppetmaster in: > > ${modulepath}/${module}/lib/facter/*.rb > > and from there they appear to be copied properly onto the clients, where > they end up in: > > /var/lib/puppet/lib/facter/*.rb > > On all clients, in puppet.log, the output of puppet-agent mentions > "Loading facts" and seems to do the right thing. However, running facter > on the client, the facts do not show up, even with --debug and with sudo. > > On the puppetmaster, they do show up in facter output as expected. > > So what''s going wrong? I''m running CentOS 6 and Puppet 2.6.6. > > Thanks, > Jonathan >I guess facter as a standalone executable doesn''t look into /var/lib/puppet. Try running FACTERLIB=/var/lib/puppet/lib/facter facter as described in the custom facts guide [1] [1] http://docs.puppetlabs.com/guides/custom_facts.html#an-example -Stefan
On 03/10/11 11:14, Stefan Schulte wrote:> On Mon, Oct 03, 2011 at 11:00:18AM +0100, Jonathan Gazeley wrote: >> Hi all, >> >> I''m experiencing some difficulty getting custom facts to run. I''ve >> installed them on the puppetmaster in: >> >> ${modulepath}/${module}/lib/facter/*.rb >> >> and from there they appear to be copied properly onto the clients, where >> they end up in: >> >> /var/lib/puppet/lib/facter/*.rb >> >> On all clients, in puppet.log, the output of puppet-agent mentions >> "Loading facts" and seems to do the right thing. However, running facter >> on the client, the facts do not show up, even with --debug and with sudo. >> >> On the puppetmaster, they do show up in facter output as expected. >> >> So what''s going wrong? I''m running CentOS 6 and Puppet 2.6.6. >> >> Thanks, >> Jonathan >> > > I guess facter as a standalone executable doesn''t look into > /var/lib/puppet. Try running > > FACTERLIB=/var/lib/puppet/lib/facter facter > > as described in the custom facts guide [1] > > [1] http://docs.puppetlabs.com/guides/custom_facts.html#an-example > > -StefanThank you. This fix enables me to view the facts on the command line. Will any further action be necessary to use the facts in Puppet? Jonathan -- 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.
On Mon, Oct 03, 2011 at 12:08:23PM +0100, Jonathan Gazeley wrote:> On 03/10/11 11:14, Stefan Schulte wrote: > > On Mon, Oct 03, 2011 at 11:00:18AM +0100, Jonathan Gazeley wrote: > >> Hi all, > >> > >> I''m experiencing some difficulty getting custom facts to run. I''ve > >> installed them on the puppetmaster in: > >> > >> ${modulepath}/${module}/lib/facter/*.rb > >> > >> and from there they appear to be copied properly onto the clients, where > >> they end up in: > >> > >> /var/lib/puppet/lib/facter/*.rb > >> > >> On all clients, in puppet.log, the output of puppet-agent mentions > >> "Loading facts" and seems to do the right thing. However, running facter > >> on the client, the facts do not show up, even with --debug and with sudo. > >> > >> On the puppetmaster, they do show up in facter output as expected. > >> > >> So what''s going wrong? I''m running CentOS 6 and Puppet 2.6.6. > >> > >> Thanks, > >> Jonathan > >> > > > > I guess facter as a standalone executable doesn''t look into > > /var/lib/puppet. Try running > > > > FACTERLIB=/var/lib/puppet/lib/facter facter > > > > as described in the custom facts guide [1] > > > > [1] http://docs.puppetlabs.com/guides/custom_facts.html#an-example > > > > -Stefan > > Thank you. This fix enables me to view the facts on the command line. > Will any further action be necessary to use the facts in Puppet? > > Jonathanno, you should be able to refer to a custom fact immediatly if your agent is configured to do pluginsync (which you apparently did enable already). -Stefan
Stefan Schulte wrote:> I guess facter as a standalone executable doesn''t look into > /var/lib/puppet. Try running > > FACTERLIB=/var/lib/puppet/lib/facter facter > > as described in the custom facts guide [1] > > [1] http://docs.puppetlabs.com/guides/custom_facts.html#an-exampleOr use the -p | --puppet option to facter. -- Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ When buying and selling are controlled by legislation, the first things to be bought and sold are legislators. -- P.J. O''Rourke
On 03/10/11 14:24, Todd Zullinger wrote:> Stefan Schulte wrote: >> I guess facter as a standalone executable doesn''t look into >> /var/lib/puppet. Try running >> >> FACTERLIB=/var/lib/puppet/lib/facter facter >> >> as described in the custom facts guide [1] >> >> [1] http://docs.puppetlabs.com/guides/custom_facts.html#an-example > > Or use the -p | --puppet option to facter. >I tried the -p option, and it didn''t seem to have any effect. But setting the FACTERLIB variable as Stefan suggested has worked. Thanks, Jonathan -- 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.
Worth noting that if you set this environment variable in one of your shell environment config files , like .bashrc, you would need to export it. Like this export FACTERLIB=/var/lib/puppet/lib/facter regards Nick On Monday, 3 October 2011 12:14:30 UTC+2, Stefan Schulte wrote:> > On Mon, Oct 03, 2011 at 11:00:18AM +0100, Jonathan Gazeley wrote: > > Hi all, > > > > I''m experiencing some difficulty getting custom facts to run. I''ve > > installed them on the puppetmaster in: > > > > ${modulepath}/${module}/lib/facter/*.rb > > > > and from there they appear to be copied properly onto the clients, where > > they end up in: > > > > /var/lib/puppet/lib/facter/*.rb > > > > On all clients, in puppet.log, the output of puppet-agent mentions > > "Loading facts" and seems to do the right thing. However, running facter > > on the client, the facts do not show up, even with --debug and with sudo. > > > > On the puppetmaster, they do show up in facter output as expected. > > > > So what''s going wrong? I''m running CentOS 6 and Puppet 2.6.6. > > > > Thanks, > > Jonathan > > > > I guess facter as a standalone executable doesn''t look into > /var/lib/puppet. Try running > > FACTERLIB=/var/lib/puppet/lib/facter facter > > as described in the custom facts guide [1] > > [1] http://docs.puppetlabs.com/guides/custom_facts.html#an-example > > -Stefan > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Wednesday, April 3, 2013 2:44:22 AM UTC-5, Codfather wrote:> > Worth noting that if you set this environment variable in one of your > shell environment config files , like .bashrc, you would need to export it. > > Like this > > export FACTERLIB=/var/lib/puppet/lib/facter > >True, but it''s even more worth noting that you should not assume that shell configuration files will be involved in any way in setting up the environment in which Facter or Puppet runs, unless you launch them manually from an interactive shell. Even then, you will find that Puppet is parsimonious about the environment it provides to child processes, so putting a variable in the agent''s environment does not necessarily imply that Facter will see it when run by the agent. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Good point John, though you must remember a lot of users utilise cron to drive the puppet run''s on standalone and agents. So this environment variable is important , especially for cloud based deployments that don''t use a puppet master. Certainly with Ubuntu servers in standalone mode, I have found that unless this is set, the custom facts are not loaded properly. Cheers Nick On Wednesday, 3 April 2013 16:23:41 UTC+2, jcbollinger wrote:> > > > On Wednesday, April 3, 2013 2:44:22 AM UTC-5, Codfather wrote: >> >> Worth noting that if you set this environment variable in one of your >> shell environment config files , like .bashrc, you would need to export it. >> >> Like this >> >> export FACTERLIB=/var/lib/puppet/lib/facter >> >> > True, but it''s even more worth noting that you should not assume that > shell configuration files will be involved in any way in setting up the > environment in which Facter or Puppet runs, unless you launch them manually > from an interactive shell. Even then, you will find that Puppet is > parsimonious about the environment it provides to child processes, so > putting a variable in the agent''s environment does not necessarily imply > that Facter will see it when run by the agent. > > > John > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
On Thursday, April 4, 2013 5:12:21 AM UTC-5, Codfather wrote:> > Good point John, though you must remember a lot of users utilise cron to > drive the puppet run''s on standalone and agents.I''m well aware of that.> > So this environment variable is important , especially for cloud based > deployments that don''t use a puppet master. >The variable is important, but for most cron implementations, .bashrc is not. Most crons take care to provide an exceedingly sparse environment to the commands they spawn, much as Puppet does. If you want your cron jobs to have that environment variable set then you should use their crontab entries to make it so, not .bashrc. If you have a cron that doesn''t require you to do so then you should find a more secure implementation. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.