trey85stang
2011-Mar-08 21:00 UTC
[Puppet Users] Need ideas on how to deploy custom software package... Stages?
I have a custom app I need to attempt to deploy with puppet but Im not quite grasping how I can do this... So I figured I would share the steps needed and maybe someone can give me an idea: 1. Run pre script to setup environment (must exit with 0) 2. Install 4 rpm packages 3. Run post installation script. (must exit with 0) That''s all I need to do, but I want to ensure that 1,2,3 never run again after the application is installed (hopefully with an onlyif or something but I''m not sure how to do that without creating errors...." My initial thought, is something along the lines of the following: class mycoolapp { exec { "bash prescript": path => "/path/to/prescript_dir", unless => "grep -q $desiredver /path/to/somefile", } package { package1: ensure => installed } package { package2: ensure => installed } pacakge { package3: ensure => installed } package { package4: ensure => installed } exec { "bash postscript": path => "/path/to/postscript_dir", } } I also see recommendations of stages? Im not sure if that would be a better route to try? Will the above do what I am looking for? -- 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.
Disconnect
2011-Mar-08 21:09 UTC
Re: [Puppet Users] Need ideas on how to deploy custom software package... Stages?
class app { exec { "prescript": refreshonly => true, command => .., } package { package1: ensure => installed, require => Exec["prescript"], notify => Exec["postscript"] } package { package2: ensure => installed, require => Package["package1"], notify => Exec["postscript"] } # or require the exec if ordering doesn''t matter .. exec { "postscript": command => "post install", refreshonly => true, } } Not 100% sure that the require will run the prescript, but I think that is correct. And the postscript will get run once at the end (even though it is notified 4 times) On Tue, Mar 8, 2011 at 4:00 PM, trey85stang <trey85stang@gmail.com> wrote:> I have a custom app I need to attempt to deploy with puppet but Im not > quite grasping how I can do this... So I figured I would share the > steps needed and maybe someone can give me an idea: > > 1. Run pre script to setup environment (must exit with 0) > 2. Install 4 rpm packages > 3. Run post installation script. (must exit with 0) > > That''s all I need to do, but I want to ensure that 1,2,3 never run > again after the application is installed (hopefully with an onlyif or > something but I''m not sure how to do that without creating errors...." > > My initial thought, is something along the lines of the following: > > class mycoolapp { > exec { "bash prescript": > path => "/path/to/prescript_dir", > unless => "grep -q $desiredver /path/to/somefile", > } > package { package1: ensure => installed } > package { package2: ensure => installed } > pacakge { package3: ensure => installed } > package { package4: ensure => installed } > exec { "bash postscript": > path => "/path/to/postscript_dir", > } > } > > I also see recommendations of stages? Im not sure if that would be a > better route to try? Will the above do what I am looking for? > > -- > 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. > >-- 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.
trey85stang
2011-Mar-08 22:10 UTC
[Puppet Users] Re: Need ideas on how to deploy custom software package... Stages?
Thanks for the suggestion, Ill give this a try. On Mar 8, 3:09 pm, Disconnect <dc.disconn...@gmail.com> wrote:> class app { > exec { "prescript": > refreshonly => true, command => .., > } > package { package1: ensure => installed, require => Exec["prescript"], > notify => Exec["postscript"] } > package { package2: ensure => installed, require => Package["package1"], > notify => Exec["postscript"] } > # or require the exec if ordering doesn''t matter > .. > exec { "postscript": > command => "post install", > refreshonly => true, > } > > } > > Not 100% sure that the require will run the prescript, but I think that is > correct. And the postscript will get run once at the end (even though it is > notified 4 times) > > On Tue, Mar 8, 2011 at 4:00 PM, trey85stang <trey85st...@gmail.com> wrote: > > I have a custom app I need to attempt to deploy with puppet but Im not > > quite grasping how I can do this... So I figured I would share the > > steps needed and maybe someone can give me an idea: > > > 1. Run pre script to setup environment (must exit with 0) > > 2. Install 4 rpm packages > > 3. Run post installation script. (must exit with 0) > > > That''s all I need to do, but I want to ensure that 1,2,3 never run > > again after the application is installed (hopefully with an onlyif or > > something but I''m not sure how to do that without creating errors...." > > > My initial thought, is something along the lines of the following: > > > class mycoolapp { > > exec { "bash prescript": > > path => "/path/to/prescript_dir", > > unless => "grep -q $desiredver /path/to/somefile", > > } > > package { package1: ensure => installed } > > package { package2: ensure => installed } > > pacakge { package3: ensure => installed } > > package { package4: ensure => installed } > > exec { "bash postscript": > > path => "/path/to/postscript_dir", > > } > > } > > > I also see recommendations of stages? Im not sure if that would be a > > better route to try? Will the above do what I am looking for? > > > -- > > 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.-- 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.
Felix Frank
2011-Mar-11 14:13 UTC
Re: [Puppet Users] Need ideas on how to deploy custom software package... Stages?
On 03/08/2011 10:09 PM, Disconnect wrote:> class app { > exec { "prescript": > refreshonly => true, command => .., > } > package { package1: ensure => installed, require => Exec["prescript"], > notify => Exec["postscript"] } > package { package2: ensure => installed, require => > Package["package1"], notify => Exec["postscript"] } > # or require the exec if ordering doesn''t matter > .. > exec { "postscript": > command => "post install", > refreshonly => true, > } > } > > Not 100% sure that the require will run the prescript, but I think that > is correct. And the postscript will get run once at the end (even though > it is notified 4 times)Probably not, as the prescript isn''t notified. The prescript should not be refreshonly and specify a sensible "onlyif" or "unless" check, so the original design is alright. (I''d use rpm -q if possible.) You can save reduncancy by merely adding Package { require => Exec["bash prescript"], notify => Exec["bash postscript"] } to the original code. HTH, Felix -- 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.
Mohamed Lrhazi
2011-Mar-11 17:57 UTC
Re: [Puppet Users] Need ideas on how to deploy custom software package... Stages?
On Tue, Mar 8, 2011 at 4:00 PM, trey85stang <trey85stang@gmail.com> wrote:> exec { "bash prescript": > path => "/path/to/prescript_dir", > unless => "grep -q $desiredver /path/to/somefile", > }The above might work.. but it''s really saying that *bash* is to be found in */path/to/prescript_dir* Right? Mohamed. -- 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.