How to unzip tar.Z file through CHEF cookbooks
There's actually nothing built into Chef for doing extracting a tar file. You have two options, either you can use the execute resource to shell out and untar or use some community cookbook like the tar cookbook that have custom resources defined for extracting tars.
In the execute
resource example it might look something like
execute 'extract_some_tar' do
command 'tar xzvf somefile.tar.gz'
cwd '/directory/of/tar/here'
not_if { File.exists?("/file/contained/in/tar/here") }
end
Whereas the third party tar cookbook definitely reads nicer
tar_package 'http://pgfoundry.org/frs/download.php/1446/pgpool-3.4.1.tar.gz' do
prefix '/usr/local'
creates '/usr/local/bin/pgpool'
end
Since Chef Client 15.0 there is a archive_file
resource built-in. It supports tar, gzip, bzip, and zip.
archive_file 'Precompiled.zip' do
path '/tmp/Precompiled.zip'
destination '/srv/files'
end