I am trying to define a puppet setup for openvz and I need to check the kernel version and all to make sure it''s right. Not clear now how I check the current running version from facter''s $kernelrelease value and if it doesn''t match - to reboot to said kernel... Anyone done this? Here''s what I got so far: class openvz { file { "/etc/sysconfig/selinux": owner => "root", mode => 644, ensure => present, contents => "SELINUX=disabled", } file { "/etc/yum.repos.d/openvz.repo": owner => "root", mode => 644, ensure => present, source => "puppet:///openvz/openvz.repo", } file {"/etc/sysctl.conf": owner => "root", mode => 644, ensure => present, source => "puppet:///openvz/sysctl.conf", } file {"/etc/modprobe.conf": owner => "root", mode => 644, ensure => present, } line {"conn_track": file => "/etc/modprobe.conf", line => "options ip_conntrack ip_conntrack_enable_ve0=1", } package {"ovzkernel-2.6.18-53.1.19.el5.028stab053.14.x86_64": ensure => installed, provider => yum, require => [File["/etc/sysconfig/selinux"],File["/etc/yum.repos.d/ openvz.repo"],File["/etc/sysctl.conf"],File["/etc/modprobe.conf"]], } package {"ovzkernel-devel-2.6.18-53.1.19.el5.028stab053.14.x86_64": ensure => installed, provider => yum, require => Package["ovzkernel- devel-2.6.18-53.1.19.el5.028stab053.14.x86_64"], } } --~--~---------~--~----~------------~-------~--~----~ 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 puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/5/2008 1:38 PM, Jeff Leggett wrote:> I am trying to define a puppet setup for openvz and I need to check > the kernel version and all to make sure it''s right. Not clear now how > I check the current running version from facter''s $kernelrelease value > and if it doesn''t match - to reboot to said kernel... Anyone done > this?Completely guessing here, but I''d expect it could be done with something like: case $kernelversion { "2.6.18-53.1.19.el5.028stab053.14": { # Things that require openvz kernel } "default": { package { "preferred-kernel": ensure => present; } file { "/boot/grub/menu.lst": ensure => present, source => "puppet:///openvzmodule/menu.lst", require => Package["preferred-kernel"], notify => Exec["/usr/sbin/update-grub"]; } exec { "/usr/sbin/update-grub": notify => Exec["shutdown"]; } exec { "shutdown": command => "/sbin/shutdown -t10 -r now"; } } } So basically using case (http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#case) to decide whether to grab some packages and files, and then applying them in the order that you might do manually (install new kernel, install new grub file, update-grub, reboot). I don''t claim this is anywhere near perfect (I do think it''s at least a workable start), and you may throw your systems into a reboot loop every time puppet runs if it''s misconfigured, but that''s why you have test systems and single-user mode, I guess. -- Mike Renfro / R&D 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 puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks Mike! That''s the kick in the right direction i was looking for... On Jun 5, 3:13 pm, Mike Renfro <ren...@tntech.edu> wrote:> On 6/5/2008 1:38 PM, Jeff Leggett wrote: > > > I am trying to define a puppet setup for openvz and I need to check > > the kernel version and all to make sure it''s right. Not clear now how > > I check the current running version from facter''s $kernelrelease value > > and if it doesn''t match - to reboot to said kernel... Anyone done > > this? > > Completely guessing here, but I''d expect it could be done with something > like: > > case $kernelversion { > > "2.6.18-53.1.19.el5.028stab053.14": { > # Things that require openvz kernel > } > "default": { > package { "preferred-kernel": > ensure => present; > } > > file { "/boot/grub/menu.lst": > ensure => present, > source => "puppet:///openvzmodule/menu.lst", > require => Package["preferred-kernel"], > notify => Exec["/usr/sbin/update-grub"]; > } > > exec { "/usr/sbin/update-grub": > notify => Exec["shutdown"]; > } > > exec { "shutdown": > command => "/sbin/shutdown -t10 -r now"; > } > } > > } > > So basically using case > (http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#case) to > decide whether to grab some packages and files, and then applying them > in the order that you might do manually (install new kernel, install new > grub file, update-grub, reboot). > > I don''t claim this is anywhere near perfect (I do think it''s at least a > workable start), and you may throw your systems into a reboot loop every > time puppet runs if it''s misconfigured, but that''s why you have test > systems and single-user mode, I guess. > > -- > Mike Renfro / R&D 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 puppet-users-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---