The best way I've found to handle folders that contain items puppet later needs 
to act on is to use fpm to turn them into an rpm/deb and add them to a repo. 
This way you're not using puppet as a file server -- something you should avoid 
wherever possible. Puppet can use a package resource to install the entire 
folder, and then notify an exec resource that runs the script.

If you'd rather not have the package in a repo, you can put the package in 
place using a file resource and have the package resource require the file 
resource.

--
Peter Bukowinski

> On Mar 17, 2014, at 6:03 AM, Stelian Iancu <[email protected]> wrote:
> 
> Hi all,
> 
> I am new to Puppet and I'm trying to accomplish a fairly simple task. I need 
> to deploy a folder to the server and, once it's copied, I need to run a shell 
> script in that folder.
> 
> Basically I have something like this:
> 
> file { "/home/user/res":
>                   ensure => "directory",
>                   owner  => "user",
>                   group  => "user",
>                   recurse => "true",
>                   ignore  => ["logs", "downloads"],
>                   purge  => "true",
>                   mode   => "0750",
>                   source => "puppet:///files/res/",
>           }
> 
>          exec { "start_res":
>                  command => "/home/user/res/run.sh"
>          }
> 
>          File['/home/user/res'] -> Exec['start_res']
> 
> The problem is that the deploymnet of the res folder is not treated 
> atomically. So once a few of the files have been copied, puppet tries to 
> execute the run.sh script which is not there at that moment.
> 
> Is there any way I can make sure that run.sh is executed only after the 
> deployment of the folder has finished?
> 
> Thanks!
> 
> S.
> -- 
> 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/0a6f9509-984d-45e2-808a-60987ea9d297%40googlegroups.com.
> 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/B9C42CA2-8FBD-41A6-BB5E-BEB8C10340CB%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to