On Aug 8, 2012, at 5:40 AM, duckegg01 wrote:
> Hi
>
> I have wriiten a class to deploy a tra file and extract on a remote puppet
> client. The tar file gets copied across fine and it seems to puppet the thet
> tar extraction suceeds, but when I check the client I dont see the extracted
> files
>
> exec { "Deploy Code":
> command => "/bin/tar -xvf /var/tmp/deploy.tar",
> onlyif => [
> "/usr/bin/test -d /var/tmp/test/" #just
> testing this
> ]
> }
I see two possible issues. First, you either need to give the exec resource a
working directory via the 'cwd' parameter, or you need to use tar's -C option
to specify where to extract the files. Without either of these, files will
extract into the home of whichever user is running puppet. So either add this
parameter:
cwd => '/var/tmp/,
or use this as your tar command ( -- # note that I skipped the verbose switch
since it's not interactive):
/bin/tar -xf /var/tmp/deploy.tar -C /var/tmp
Another possible issue: If you want /var/tmp/deploy.tar to extract to
/var/tmp/test, then you need to leave off the 'onlyif' parameter. Currently,
the exec will only run if /var/tmp/test already exists.
One last thing. If you haven't done so already, set up a dependency between the
file resource that copies the tar file to the node and the exec resource that
extracts it -- either via a notify parameter in the file resource or a require
parameter in the exec resource.
--
Peter Bukowinski
--
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.