Mike Reed
2012-Jun-27 01:12 UTC
[Puppet Users] Distribution upgrade and subsequent reboot of machine
Hello all, In building out an initial workstation configuration (Ubuntu 10.04 lucid) via Puppet, I have the need to do two things in order. The first is to do a dist-upgrade on the workstation and reboot, followed by an install of a Nvida driver. Upon doing a dist-upgrade, I have to reboot the machine in order for the workstation to start using the new linux-headers because if I install the Nvidia drivers without doing a reboot after a dist-upgrade, the drivers will compile against the old headers and my gui no longer works and X won''t start because of a modprobe issue. With that said, I''ve written the dist-upgrade manifest as so: class dist_upgrade { exec { "dist_upgrade" : command => "/usr/bin/apt-get -y dist-upgrade" , } exec { "purge_linux-headers-2.6.32-38" : command => "/usr/bin/apt-get -y purge linux-headers-2.6.32-38" , require => Exec[''dist_upgrade''] , } exec { "purge_linux-image-2.6.32-38-server" : command => "/usr/bin/apt-get -y purge linux-image-2.6.32-38-server" , require => Exec[''purge_linux-headers-2.6.32-38''] , } #This is done so the system starts using the new headers/image exec { "reboot_after_dist_upgrade" : command => "/sbin/reboot" , subscribe => Exec["purge_linux-image-2.6.32-38-server"] , refreshonly => true , } } This seems to be doing the job but I feel it''s a bit of a hack and I was wondering if anybody had an opinion as to if this can be done in a cleaner fashion. I''m still very new to Puppet so please excuse my novice example. Thanks in advance for the help and support. Cheers, Mike -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/R5BQkgRvyt4J. 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.
Mike Reed
2012-Jun-27 01:37 UTC
[Puppet Users] Re: Distribution upgrade and subsequent reboot of machine
As an update, after running this a few times after this initial post, I''m seeing the machine reboot after new classes have been added which is not desired. I might have to rethink the reboot approach. Thanks again, Mike On Tuesday, June 26, 2012 6:12:05 PM UTC-7, Mike Reed wrote:> > Hello all, > > In building out an initial workstation configuration (Ubuntu 10.04 lucid) > via Puppet, I have the need to do two things in order. The first is to do > a dist-upgrade on the workstation and reboot, followed by an install of a > Nvida driver. Upon doing a dist-upgrade, I have to reboot the machine in > order for the workstation to start using the new linux-headers because if I > install the Nvidia drivers without doing a reboot after a dist-upgrade, the > drivers will compile against the old headers and my gui no longer works and > X won''t start because of a modprobe issue. > > With that said, I''ve written the dist-upgrade manifest as so: > > class dist_upgrade { > exec { "dist_upgrade" : > command => "/usr/bin/apt-get -y dist-upgrade" , > } > > exec { "purge_linux-headers-2.6.32-38" : > command => "/usr/bin/apt-get -y purge > linux-headers-2.6.32-38" , > require => Exec[''dist_upgrade''] , > } > > exec { "purge_linux-image-2.6.32-38-server" : > command => "/usr/bin/apt-get -y purge > linux-image-2.6.32-38-server" , > require => Exec[''purge_linux-headers-2.6.32-38''] , > } > > #This is done so the system starts using the new headers/image > exec { "reboot_after_dist_upgrade" : > command => "/sbin/reboot" , > subscribe => Exec["purge_linux-image-2.6.32-38-server"] , > refreshonly => true , > } > } > > This seems to be doing the job but I feel it''s a bit of a hack and I was > wondering if anybody had an opinion as to if this can be done in a cleaner > fashion. I''m still very new to Puppet so please excuse my novice example. > > Thanks in advance for the help and support. > > Cheers, > > Mike >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/57Oa8W-NhqgJ. 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.
Peter Brown
2012-Jun-27 01:37 UTC
Re: [Puppet Users] Distribution upgrade and subsequent reboot of machine
Hi Mike, Just as a side not I would be rather hesitant to set this up with puppet. This may be a job for some other tool like mcollective but I have not ventured into the land yet. This may work but I haven''t done any testing so please test this on a non production server before rolling it out. I would try a notify in your exec { "purge_linux-image-2.6.32-38-server" : resource and take the subscribe out of the reboot. Something like this. exec { "purge_linux-image-2.6.32-38-server" : command => "/usr/bin/apt-get -y purge linux-image-2.6.32-38-server" , require => Exec[''purge_linux-headers-2.6.32-38''] , notify => Exec["reboot_after_dist_upgrade"] } #This is done so the system starts using the new headers/image exec { "reboot_after_dist_upgrade" : command => "/sbin/reboot" , refreshonly => true , } On 27 June 2012 11:12, Mike Reed <mjohn.reed@gmail.com> wrote:> Hello all, > > In building out an initial workstation configuration (Ubuntu 10.04 lucid) > via Puppet, I have the need to do two things in order. The first is to do a > dist-upgrade on the workstation and reboot, followed by an install of a > Nvida driver. Upon doing a dist-upgrade, I have to reboot the machine in > order for the workstation to start using the new linux-headers because if I > install the Nvidia drivers without doing a reboot after a dist-upgrade, the > drivers will compile against the old headers and my gui no longer works and > X won''t start because of a modprobe issue. > > With that said, I''ve written the dist-upgrade manifest as so: > > class dist_upgrade { > exec { "dist_upgrade" : > command => "/usr/bin/apt-get -y dist-upgrade" , > } > > exec { "purge_linux-headers-2.6.32-38" : > command => "/usr/bin/apt-get -y purge > linux-headers-2.6.32-38" , > require => Exec[''dist_upgrade''] , > } > > exec { "purge_linux-image-2.6.32-38-server" : > command => "/usr/bin/apt-get -y purge > linux-image-2.6.32-38-server" , > require => Exec[''purge_linux-headers-2.6.32-38''] , > } > > #This is done so the system starts using the new headers/image > exec { "reboot_after_dist_upgrade" : > command => "/sbin/reboot" , > subscribe => Exec["purge_linux-image-2.6.32-38-server"] , > refreshonly => true , > } > } > > This seems to be doing the job but I feel it''s a bit of a hack and I was > wondering if anybody had an opinion as to if this can be done in a cleaner > fashion. I''m still very new to Puppet so please excuse my novice example. > > Thanks in advance for the help and support. > > Cheers, > > Mike > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/R5BQkgRvyt4J. > 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.-- 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.
jcbollinger
2012-Jun-27 15:02 UTC
[Puppet Users] Re: Distribution upgrade and subsequent reboot of machine
On Tuesday, June 26, 2012 8:12:05 PM UTC-5, Mike Reed wrote:> > exec { "purge_linux-image-2.6.32-38-server" : > command => "/usr/bin/apt-get -y purge > linux-image-2.6.32-38-server" , > require => Exec[''purge_linux-headers-2.6.32-38''] , > } > > #This is done so the system starts using the new headers/image > exec { "reboot_after_dist_upgrade" : > command => "/sbin/reboot" , > subscribe => Exec["purge_linux-image-2.6.32-38-server"] , > refreshonly => true , > } >That combination is wrong if you do not in fact intend for Puppet to reboot the machine on every run. The problem is that Exec[" purge_linux-image-2.6.32-38-server"] runs its command every time, and any time an Exec runs its command is considered a change (thus triggering subscribers to refresh). You can avoid that by setting an appropriate command in the ''onlyif'' or ''unless'' parameter of that Exec; these plus ''creates'' are how an Exec determines whether it is already in sync. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/ORPq_sllUnYJ. 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.
Mike Reed
2012-Jun-27 17:20 UTC
[Puppet Users] Re: Distribution upgrade and subsequent reboot of machine
Hey John, Thanks for the reply. I''ll look up the ''onlyif'' and ''unless'' usage and see which might best suit my needs. Thank you for pointing me in the right direction. Cheers, Mike On Wednesday, June 27, 2012 8:02:16 AM UTC-7, jcbollinger wrote:> > > > On Tuesday, June 26, 2012 8:12:05 PM UTC-5, Mike Reed wrote: >> >> exec { "purge_linux-image-2.6.32-38-server" : >> command => "/usr/bin/apt-get -y purge >> linux-image-2.6.32-38-server" , >> require => Exec[''purge_linux-headers-2.6.32-38''] , >> } >> >> #This is done so the system starts using the new headers/image >> exec { "reboot_after_dist_upgrade" : >> command => "/sbin/reboot" , >> subscribe => Exec["purge_linux-image-2.6.32-38-server"] , >> refreshonly => true , >> } >> > > That combination is wrong if you do not in fact intend for Puppet to > reboot the machine on every run. The problem is that Exec[" > purge_linux-image-2.6.32-38-server"] runs its command every time, and any > time an Exec runs its command is considered a change (thus triggering > subscribers to refresh). You can avoid that by setting an appropriate > command in the ''onlyif'' or ''unless'' parameter of that Exec; these plus > ''creates'' are how an Exec determines whether it is already in sync. > > John > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/rTrzbZna438J. 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.
Mike Reed
2012-Jun-27 17:24 UTC
Re: [Puppet Users] Distribution upgrade and subsequent reboot of machine
Hey Pete, I haven''t had a chance to venture into mcollective yet but that''s a great thought and I''ll put that on my list of things to "investigate". I''m only running puppet against one machine and it''s a box I don''t care about so I''ll give this a run and see how it goes. I wanted to thank you for the suggestion and help. Cheers, Mike On Tuesday, June 26, 2012 6:37:52 PM UTC-7, Pete wrote:> > Hi Mike, > > Just as a side not I would be rather hesitant to set this up with puppet. > This may be a job for some other tool like mcollective but I have not > ventured into the land yet. > > This may work but I haven''t done any testing so please test this on a > non production server before rolling it out. > > I would try a notify in your exec { > "purge_linux-image-2.6.32-38-server" : resource and take the subscribe > out of the reboot. > > Something like this. > > exec { "purge_linux-image-2.6.32-38-server" : > command => "/usr/bin/apt-get -y purge > linux-image-2.6.32-38-server" , > require => Exec[''purge_linux-headers-2.6.32-38''] , > notify => Exec["reboot_after_dist_upgrade"] > } > #This is done so the system starts using the new headers/image > exec { "reboot_after_dist_upgrade" : > command => "/sbin/reboot" , > refreshonly => true , > } > > > On 27 June 2012 11:12, Mike Reed wrote: > > Hello all, > > > > In building out an initial workstation configuration (Ubuntu 10.04 > lucid) > > via Puppet, I have the need to do two things in order. The first is to > do a > > dist-upgrade on the workstation and reboot, followed by an install of a > > Nvida driver. Upon doing a dist-upgrade, I have to reboot the machine > in > > order for the workstation to start using the new linux-headers because > if I > > install the Nvidia drivers without doing a reboot after a dist-upgrade, > the > > drivers will compile against the old headers and my gui no longer works > and > > X won''t start because of a modprobe issue. > > > > With that said, I''ve written the dist-upgrade manifest as so: > > > > class dist_upgrade { > > exec { "dist_upgrade" : > > command => "/usr/bin/apt-get -y dist-upgrade" , > > } > > > > exec { "purge_linux-headers-2.6.32-38" : > > command => "/usr/bin/apt-get -y purge > > linux-headers-2.6.32-38" , > > require => Exec[''dist_upgrade''] , > > } > > > > exec { "purge_linux-image-2.6.32-38-server" : > > command => "/usr/bin/apt-get -y purge > > linux-image-2.6.32-38-server" , > > require => Exec[''purge_linux-headers-2.6.32-38''] , > > } > > > > #This is done so the system starts using the new headers/image > > exec { "reboot_after_dist_upgrade" : > > command => "/sbin/reboot" , > > subscribe => Exec["purge_linux-image-2.6.32-38-server"] > , > > refreshonly => true , > > } > > } > > > > This seems to be doing the job but I feel it''s a bit of a hack and I was > > wondering if anybody had an opinion as to if this can be done in a > cleaner > > fashion. I''m still very new to Puppet so please excuse my novice > example. > > > > Thanks in advance for the help and support. > > > > Cheers, > > > > Mike > > > > -- > > You received this message because you are subscribed to the Google > Groups > > "Puppet Users" group. > > To view this discussion on the web visit > > https://groups.google.com/d/msg/puppet-users/-/R5BQkgRvyt4J. > > 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. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/sc_uIsXu_wEJ. 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.
Peter Brown
2012-Jun-28 00:25 UTC
Re: [Puppet Users] Re: Distribution upgrade and subsequent reboot of machine
On 28 June 2012 01:02, jcbollinger <John.Bollinger@stjude.org> wrote:> > > On Tuesday, June 26, 2012 8:12:05 PM UTC-5, Mike Reed wrote: >> >> exec { "purge_linux-image-2.6.32-38-server" : >> command => "/usr/bin/apt-get -y purge >> linux-image-2.6.32-38-server" , >> require => Exec[''purge_linux-headers-2.6.32-38''] , >> } >> >> #This is done so the system starts using the new headers/image >> exec { "reboot_after_dist_upgrade" : >> command => "/sbin/reboot" , >> subscribe => Exec["purge_linux-image-2.6.32-38-server"] , >> refreshonly => true , >> } > > > That combination is wrong if you do not in fact intend for Puppet to reboot > the machine on every run. The problem is that > Exec["purge_linux-image-2.6.32-38-server"] runs its command every time, and > any time an Exec runs its command is considered a change (thus triggering > subscribers to refresh). You can avoid that by setting an appropriate > command in the ''onlyif'' or ''unless'' parameter of that Exec; these plus > ''creates'' are how an Exec determines whether it is already in sync.Much better idea that mine. I was thinking that at the time but got distracted by fixing something urgent. onlyif and creates are very handy for this sort of thing (or creating and ensuring virtual machines are built and running which is what use them for)> John > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/ORPq_sllUnYJ. > > 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.-- 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.
Peter Brown
2012-Jun-28 00:26 UTC
Re: [Puppet Users] Distribution upgrade and subsequent reboot of machine
No worries. Hope it helps. I have been looking for an excuse to venture into mcollective but haven''t needed it yet. On 28 June 2012 03:24, Mike Reed <mjohn.reed@gmail.com> wrote:> Hey Pete, > > I haven''t had a chance to venture into mcollective yet but that''s a great > thought and I''ll put that on my list of things to "investigate". I''m only > running puppet against one machine and it''s a box I don''t care about so I''ll > give this a run and see how it goes. I wanted to thank you for the > suggestion and help. > > Cheers, > > Mike > > > On Tuesday, June 26, 2012 6:37:52 PM UTC-7, Pete wrote: >> >> Hi Mike, >> >> Just as a side not I would be rather hesitant to set this up with puppet. >> This may be a job for some other tool like mcollective but I have not >> ventured into the land yet. >> >> This may work but I haven''t done any testing so please test this on a >> non production server before rolling it out. >> >> I would try a notify in your exec { >> "purge_linux-image-2.6.32-38-server" : resource and take the subscribe >> out of the reboot. >> >> Something like this. >> >> exec { "purge_linux-image-2.6.32-38-server" : >> command => "/usr/bin/apt-get -y purge >> linux-image-2.6.32-38-server" , >> require => Exec[''purge_linux-headers-2.6.32-38''] , >> notify => Exec["reboot_after_dist_upgrade"] >> } >> #This is done so the system starts using the new headers/image >> exec { "reboot_after_dist_upgrade" : >> command => "/sbin/reboot" , >> refreshonly => true , >> } >> >> >> On 27 June 2012 11:12, Mike Reed wrote: >> > Hello all, >> > >> > In building out an initial workstation configuration (Ubuntu 10.04 >> > lucid) >> > via Puppet, I have the need to do two things in order. The first is to >> > do a >> > dist-upgrade on the workstation and reboot, followed by an install of a >> > Nvida driver. Upon doing a dist-upgrade, I have to reboot the machine >> > in >> > order for the workstation to start using the new linux-headers because >> > if I >> > install the Nvidia drivers without doing a reboot after a dist-upgrade, >> > the >> > drivers will compile against the old headers and my gui no longer works >> > and >> > X won''t start because of a modprobe issue. >> > >> > With that said, I''ve written the dist-upgrade manifest as so: >> > >> > class dist_upgrade { >> > exec { "dist_upgrade" : >> > command => "/usr/bin/apt-get -y dist-upgrade" , >> > } >> > >> > exec { "purge_linux-headers-2.6.32-38" : >> > command => "/usr/bin/apt-get -y purge >> > linux-headers-2.6.32-38" , >> > require => Exec[''dist_upgrade''] , >> > } >> > >> > exec { "purge_linux-image-2.6.32-38-server" : >> > command => "/usr/bin/apt-get -y purge >> > linux-image-2.6.32-38-server" , >> > require => Exec[''purge_linux-headers-2.6.32-38''] , >> > } >> > >> > #This is done so the system starts using the new headers/image >> > exec { "reboot_after_dist_upgrade" : >> > command => "/sbin/reboot" , >> > subscribe => Exec["purge_linux-image-2.6.32-38-server"] >> > , >> > refreshonly => true , >> > } >> > } >> > >> > This seems to be doing the job but I feel it''s a bit of a hack and I was >> > wondering if anybody had an opinion as to if this can be done in a >> > cleaner >> > fashion. I''m still very new to Puppet so please excuse my novice >> > example. >> > >> > Thanks in advance for the help and support. >> > >> > Cheers, >> > >> > Mike >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "Puppet Users" group. >> > To view this discussion on the web visit >> > https://groups.google.com/d/msg/puppet-users/-/R5BQkgRvyt4J. >> > 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. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/sc_uIsXu_wEJ. > > 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.-- 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.