In general puppet is a poor script executor as it wasn't designed to do
that.

You'll can use explicit ordering and chaining as described in the link
given or you can look at what you are doing in your shell scripts and
refactor into puppet code.  In the long run you will be a lot better off
refactoring your shell scripts as you'll be able to take advantage of
things Puppet was designed to do.

Exec should be used as a last resort to accomplish something Puppet does
not support.

On Wed, Jun 24, 2015 at 6:22 AM, Ayyanar <[email protected]> wrote:

>
> == My site.pp contains shell script executing. I need to run this file
> according to this order.
>
> class hadinstall {
>
>     file { "/home/haas/a1.sh":
>         mode => "0755",
>         owner => 'haas',
>         group => 'haas',
>         source => 'puppet:///modules/scripts/01-hadoop-install.sh',
>     }
>
>     exec { "/home/haas/a1.sh":
>     }
>
> }
>
> class haddir {
>     file { "/home/haas/b1.sh":
>         mode => "0755",
>         owner => 'haas',
>         group => 'haas',
>         source => 'puppet:///modules/scripts/02-hadoop-directories.sh',
>     }
>
>     exec { "/home/haas/b1.sh":
>     }
>
> }
>
> class hadconf {
>     file { "/home/haas/hadoop-config.jar":
>         mode => "0755",
>         owner => 'haas',
>         group => 'haas',
>         source => 'puppet:///modules/scripts/hadoop-config.jar',
>     }
>
>     file { "/home/haas/c1-.sh":
>         mode => "0755",
>         owner => 'haas',
>         group => 'haas',
>         source =>
> 'puppet:///modules/scripts/03-hadoop-config-jar-extract.sh',
>     }
>
>     exec { "/home/haas/c1.sh":
>     }
> }
>
>
> class hadconfextract {
>     file { "/home/haas/d1.sh":
>         mode => "0755",
>         owner => 'haas',
>         group => 'haas',
>         source => 'puppet:///modules/scripts/04-hadoop-config.sh',
>
>     exec { "/home/haas/d1.sh":
>     }
>
> }
>
>
>
> But in agent executes file in different order. How to solve this.
>
>
> [root@h1 manifests]# puppet apply site.pp
> Notice: Compiled catalog for h1.lab.orzota.com in environment production
> in 0.13 seconds
> Notice: /Stage[main]/D/Exec[/root/d1.sh]/returns: executed successfully
> Notice: /Stage[main]/C/Exec[/root/a1.sh]/returns: executed successfully
> Notice: /Stage[main]/A/Exec[/root/b1.sh]/returns: executed successfully
> Notice: /Stage[main]/B/Exec[/root/c1.sh]/returns: executed successfully
> Notice: Finished catalog run in 0.40 seconds
> [root@h1 manifests]#
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/5e4e08db-6306-4f44-903d-10f18d19b471%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/5e4e08db-6306-4f44-903d-10f18d19b471%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAKXjC7FR7h-6DZihNaDgMTTbsDA9KME286pQ9dF%2BEO8wDWR46A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to