and interestingly, I see this when running puppet on the client: info: Loading facts in /var/lib/puppet/facts/pgsql_pkg.rb
but it still doesn't appear in the output of `facter` or `facter -p` On Monday, September 24, 2012 12:35:39 PM UTC-7, Justin Ryan wrote: > > also, as suggested in the *Pro Puppet* book, I: > > > - copied the ruby file to ~/lib/ruby/facter/ > - export RUBYLIB=~/lib/ruby > - facter pgsql_pkg > - it printed "itworks" as expected. > > > I'm running puppet 2.7.18 on the master and 2.7.19 on the client, all are > CentOS 6. > > On Monday, September 24, 2012 12:20:07 PM UTC-7, Justin Ryan wrote: >> >> Thanks John, that's exactly what I'm looking for, but am having trouble >> getting it to work. I read the Custom >> Facts<http://docs.puppetlabs.com/guides/custom_facts.html>and Plugins >> in Modules <http://docs.puppetlabs.com/guides/plugins_in_modules.html> docs, >> and: >> >> added pluginsync = true to puppet.conf on the puppetmaster and restarted >> the service: >> >> [root@puppet01 facter]# puppet config print all |grep pluginsync >> pluginsync = true >> >> added my custom fact to {module}/lib/facter/pgsql_pkg.rb: >> >> Facter.add("pgsql_pkg") do >> setcode do >> Facter::Util::Resolution.exec("echo itworks") >> end >> end >> >> but then after doing a puppet run on the client, it does not appear in >> the output of facter [-p]. I do see the script has synced to >> /var/lib/puppet/facts on the client. >> >> any ideas? thanks. >> >> >> >> On Monday, September 24, 2012 7:21:04 AM UTC-7, jcbollinger wrote: >>> >>> >>> >>> On Friday, September 21, 2012 7:40:52 PM UTC-5, Justin Ryan wrote: >>>> >>>> I would like to place a file with puppet only if a certain package is >>>> installed on the system -- but assuming this package is not >>>> puppet-managed. >>>> Checking for the presence of a non-puppet-managed file is also ok. Is this >>>> possible? using require => Package['mypkg'] doesn't work if it's not >>>> puppet-managed. thanks. >>> >>> >>> >>> For those details where you want Puppet to adapt to the client node >>> instead of managing it to a known state, your first recourse should be node >>> facts. Puppet and Facter don't provide built-in facts describing whether >>> particular packages are installed, but it's pretty easy to write custom >>> facts and distribute them via Puppet's 'pluginsync' mechanism. See, for >>> example, http://docs.puppetlabs.com/guides/custom_facts.html. >>> >>> Supposing that you create a custom fact 'mypkg_installed', you could >>> then use something like this in your manifest: >>> >>> if $::mypkg_installed == 'yes' { >>> file { '/etc/mypkg/special-file': >>> # ... >>> } >>> } >>> >>> (Note that that does not force the file absent if the package is not >>> installed; that's certainly possible, but I leave it as an exercise.) >>> >>> >>> John >>> >>> -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/J-t-9XqfxoAJ. To post to this group, send email to puppet-users@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.