Hello guys :),
I''m kind of new to Puppet and stuck in defining a conditional
statement.
Here my problem:
I want to provide different apt/source.list for different versions of
Debian, 6.0.x and 7.0.x, which also run different versions of Puppet, 2.7.x
and 3.2.x. My first idea was to use facters variable
operatingsystemmajrelease and define like this:
file { ''/etc/apt/sources.list'':
source => $operatingsystemmajrelease ? {
6 => ''puppet:///modules/apt/sources.list_debian6'',
7 => ''puppet:///modules/apt/sources.list_debian7'',
},
owner => ''root'',
group => ''root'',
mode => ''0644'',
}
This works nice for Puppet 3.2.2, but this variable isn''t available on
the
2.7.x hosts :/. Next idea, use the facter operatingsystemrelease variable,
but I can''t find a resource to describe something like:
if the $operatingsystemrelease is bigger/equal then 6.0.0 but smaller then
7.0.0 then provide source.list.debian6
if else $operatingsystemrelease is bigger/equal 7.0.0 then provide
source.list.debian7
else do nothing
Maybe someone can me point in the right direction, would be very nice :).
Cheers,
Szop
--
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.
For more options, visit https://groups.google.com/groups/opt_out.
On Thu, Jun 27, 2013 at 2:22 AM, David Jarosch <jarosch.david@googlemail.com> wrote:> Hello guys :), > > I''m kind of new to Puppet and stuck in defining a conditional statement. > Here my problem: > > I want to provide different apt/source.list for different versions of > Debian, 6.0.x and 7.0.x, which also run different versions of Puppet, 2.7.x > and 3.2.x. My first idea was to use facters variable > operatingsystemmajrelease and define like this: > > file { ''/etc/apt/sources.list'': > source => $operatingsystemmajrelease ? { > 6 => ''puppet:///modules/apt/sources.list_debian6'', > 7 => ''puppet:///modules/apt/sources.list_debian7'', > }, > owner => ''root'', > group => ''root'', > mode => ''0644'', > } > > This works nice for Puppet 3.2.2, but this variable isn''t available on the > 2.7.x hosts :/. Next idea, use the facter operatingsystemrelease variable, > but I can''t find a resource to describe something like: >Probably facter version. It''s possible to upgrade to a later version for the 2.7 series.> if the $operatingsystemrelease is bigger/equal then 6.0.0 but smaller then > 7.0.0 then provide source.list.debian6 > if else $operatingsystemrelease is bigger/equal 7.0.0 then provide > source.list.debian7 > else do nothing > > Maybe someone can me point in the right direction, would be very nice :). >Try the versioncmp function. HTH, Nan -- 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. For more options, visit https://groups.google.com/groups/opt_out.
On 06/27/2013 11:22 AM, David Jarosch wrote:> if the $operatingsystemrelease is bigger/equal then 6.0.0 but smaller > then 7.0.0 then provide source.list.debian6 > if else $operatingsystemrelease is bigger/equal 7.0.0 then provide > source.list.debian7 > else do nothingMaybe you can use something like this: case $::operatingsystemrelease { default: {} /^6.*/: { file { ''bla'': source => ''bla6'', } } /^7.*/: { file { ''bla'': source => ''bla7'', } } } -- Jakov Sosic www.srce.unizg.hr -- 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. For more options, visit https://groups.google.com/groups/opt_out.