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+unsubscr...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to