I've been doing like this. (Don't know if it is the better ways.. but.. :))
if ($operatingsystemrelease >= 4) and ($operatingsystemrelease < 5) {
$release = "el4"
}
else {
if ($operatingsystemrelease >= 5) and ($operatingsystemrelease < 6) {
$release = "el5"
}
}
package { abc: ensure => "0.25.5-1.${release}" }
PS.: I am running puppet 0.25.x in 2.6 I believe there is a elsif or
something like that...
Gus
On Wed, Aug 11, 2010 at 1:52 PM, Nigel Kersten <[email protected]> wrote:
> On Wed, Aug 11, 2010 at 9:48 AM, Nan Liu <[email protected]> wrote:
> > On Wed, Aug 11, 2010 at 11:55 AM, Jason Amato <[email protected]>
> wrote:
> >>
> >> How can I create a class to install a RPM based on the o/s type and
> >> the o/s release.
> >> I want to install a package on SLES, but only if it's release 11, not
> >> 10.
> >>
> >
> > I suppose you can write nested if statements. Not sure if there are other
> > more elegant methods. Assuming facter $operatingsystemrelease for SLES 11
> > returns 11.x, is this what you are looking for?
> >
> > $os_release = "${operatingsystem}-${operatingsystemrelease}"
> >
> > $pkg = ${os_release} ? {
> > /^OEL-/ => redhat-lsb,
> > /^SLES-11./ => lsb,
> > default => redhat-lsb,
> > }
> >
> > package { $pkg:
> > ensure => installed,
> > }
>
> Won't that try to install 'redhat-lsb' on SLES 10 ?
>
> I think you want
>
> ensure => undef
>
> for SLES 10 if you truly want to not manage it.
>
> I tend to be more of a fan of explicit conditional statements outside
> resource definitions these days, nested selectors are harder to parse
> quickly, and now we have decent conditional logic, it's much easier.
>
>
>
> >
> > Thanks,
> >
> > Nan
> >
> > --
> > 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]<puppet-users%[email protected]>
> .
> > For more options, visit this group at
> > http://groups.google.com/group/puppet-users?hl=en.
> >
>
>
>
> --
> nigel
>
> --
> 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]<puppet-users%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/puppet-users?hl=en.
>
>
--
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.