[Puppet Users] Re: custom fact help
Follow up on this: My code was fine. Somehow the level variable I was using got stuck on normal. That is, when I ran puppetd -t. Even if I removed level = normal from the manifest, just leaving level = confidential, normal was returned. When puppetd ran as a daemon, the correct variable was returned. The fix was to remove /var/lib/puppet/yaml/facts/puppet.example.com.yaml. Kent 2008/9/11 Kenton Brede [EMAIL PROTECTED]: I'm trying to create a custom fact. The following code works fine if puppetd runs as a daemon but not from the command line. In other words if this runs on server5 as a daemon, the return is correct, confidential. But if I run puppetd -t from the command line normal is returned. I don't really know ruby so I'm not confident about the code or using the facter/setcode method. Anything I'm doing wrong or is this a puppet/facter bug? I'm using puppetd 0.24.5 and facter 1.5.1. Thanks, Kent Facter.add(security_level) do def sec_level() # grab hostname require socket hostname = Socket.gethostname # check if hostname matches and designate security level if hostname =~ /(server2|server5|server28)/ level = 'confidential' else level = 'normal' end return level end setcode do sec_level end end - --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~--~~~~--~~--~--~---
[Puppet Users] Re: environments variables
On 9/12/2008 11:40 AM, Richard wrote: I am probably way off base here but I wanted to do something similar (I think) although I'm not using environments, yet. I have multiple types of hardware (1U rack small desktop box) that I want to manage with the same set of files. However the only way I can tell them apart is by hostname; factor doesn't really have any way to distinguish between the hardware. I think it might, actually. Not sure how it's getting it, but here's an abridged paste from one of my older Ubuntu workstations that appears to include manufacturer, model, and even the service tag or some other serial number: # facter architecture = i386 debianversion = etch domain = cae.tntech.edu facterversion = 1.3.8 ... kernel = Linux kernelrelease = 2.6.20-16-generic lsbdistcodename = feisty lsbdistdescription = Ubuntu 7.04 lsbdistid = Ubuntu lsbdistrelease = 7.04 ... manufacturer = Dell Computer Corporation memoryfree = 845.25 MB memorysize = 1010.98 MB operatingsystem = Debian operatingsystemrelease = 2.6.20-16-generic processor0 = Intel(R) Xeon(TM) CPU 1.80GHz processor1 = Intel(R) Xeon(TM) CPU 1.80GHz processorcount = 2 productname = Precision WorkStation 530 MT ps = ps -ef puppetversion = 0.23.2 rubysitedir = /usr/local/lib/site_ruby/1.8 rubyversion = 1.8.5 serialnumber = H0SNB11 ... -- Mike Renfro / RD Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~--~~~~--~~--~--~---
[Puppet Users] Re: environments variables
in facter older than 1.5 some systems (like rh 5) dmidecode facts will not be parsed correctly. you could add more facts easily in the manufacture.rb file Ohad On Sat, Sep 13, 2008 at 1:56 AM, Jason Kohles [EMAIL PROTECTED] wrote: On Sep 12, 2008, at 1:14 PM, Mike Renfro wrote: On 9/12/2008 11:40 AM, Richard wrote: I am probably way off base here but I wanted to do something similar (I think) although I'm not using environments, yet. I have multiple types of hardware (1U rack small desktop box) that I want to manage with the same set of files. However the only way I can tell them apart is by hostname; factor doesn't really have any way to distinguish between the hardware. I think it might, actually. Not sure how it's getting it, but here's an abridged paste from one of my older Ubuntu workstations that appears to include manufacturer, model, and even the service tag or some other serial number: It's getting that information from the BIOS, using dmidecode. If you have hosts that don't include that information in their facter output, make sure you have dmidecode installed on them... -- Jason Kohles, RHCA RHCDS RHCE [EMAIL PROTECTED] - http://www.jasonkohles.com/ A witty saying proves nothing. -- Voltaire --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~--~~~~--~~--~--~---