On Mon, Feb 13, 2012 at 9:17 AM, Jeffrey Watts <[email protected]>wrote:

> Gary, I've been solving this problem by using the following
> inline_template in the modules that need to get the major release version:
> $os_major_ver = inline_template("<%= operatingsystemrelease.split('.')[0]
> %>")
>
> I'm new to Puppet, and I like the elegance of your example below - to
> implement it, would I need to put that block in
> <modulename>/lib/facter/operatingsystemmajor.rb?  I assume I'd need to put
> that in every module that'd use it.  Is there a better way?  I currently
> use that block in 3 or 4 modules.
>
> Thanks!
> Jeffrey.
>


Hi Jeffrey,

You're correct about the placement of the file, however you don't need to
include it in EVERY module you use.  That fact only needs to be in ONE of
your modules for every node to utilize it as a Facter fact (currently, ANY
Facter facts that are in your $modulepatch get loaded by ALL of your nodes).

So repeating this code is very redundant.  Does this makes sense?



>
> On Sun, Feb 12, 2012 at 6:25 PM, Gary Larizza <[email protected]> wrote:
>
>> There's also the 'operatingsystemrelease' fact that will evaluate to the
>> full version.  You could do this:
>>
>> Facter.add('operatingsystemmajor') do
>>   setcode do
>>     Facter.value('operatingsystemrelease').split('.').first
>>   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 [email protected].
> 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.
>



-- 

Gary Larizza
Professional Services Engineer
Puppet Labs

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
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.

Reply via email to