I would try something like:
file { "/var/tmp/files":
ensure => "directory",
...
notify => Exec[
exec { "foo":
command => "echo * | xargs tar xf ",
cwd => "/var/tmp/files",
refreshonly => true,
}
On Fri, Apr 15, 2011 at 12:29 PM, Prateep <[email protected]> wrote:
> Hi all,
>
> Newbie question here...
>
> I'm trying to figure out how to execute a command for every file in a
> directory.
>
> For example, I recursively copy a bunch of tar files and then I want
> to run a command against them
>
> My understanding is that the file resource will execute first, copying
> all of the files. After that the exec resource will occur. Is that
> right? If so, how do I run an exec for every file?
>
> Ideally, I want to do something like this, but to have the exec occur
> for every individual file:
>
> file { "/var/tmp/files":
> ensure => "directory",
> recurse => true,
> purge => true,
> backup => false,
> mode => "755",
> source => "puppet:///files",
> }
>
> exec { "foo":
> command => "tar xf FILENAME",
> cwd => "/var/tmp/files",
> subscribe => File["/var/tmp/files"],
>
> }
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.