- From: Joshua Timberman <
>
- To:
- Subject: [chef] Re: VMWareTools-installation
- Date: Fri, 20 May 2011 17:06:11 -0600
Hello!
On Wednesday, May 18, 2011 at 6:45 AM, WEINHAPL Andreas wrote:
>
Today I ve created a new role named “VMWare_Install” Its based on Ubuntu /
>
Debian! So the first thing I do is to copy the *.tar.gz into my node
>
working directory (with an cookbook_file statement) after that I will will
>
extract it with an execute command. If this is finished I’ll begin to
>
compare the installation version with the local vesion of the VMWareTools.
Did you create the file in the cookbook's "files/default" directory?
http://wiki.opscode.com/display/chef/File+Distribution
Also, I suggest a couple changes to your resources, noted below:
>
cookbook_file "/tmp/VMWareTools.tar.gz" do
>
puts "Copy File to its place\n"
>
source "VMWareTools.tar.gz"
>
owner "root"
>
group "root"
>
mode 0777
>
end
I would use the "checksum" parameter in this resource to ensure that the file
is not copied every time. You will need a SHA256 checksum, and can generate
that. On linux, use sha256sum:
sha256sum VMwareTools.tar.gz
Mac OS X does not have a sha256sum binary, but you can generate the checksum
with a Chef library :)
ruby -rchef/checksum_cache -e 'puts
Chef::ChecksumCache.checksum_for_file("VMWareTools.tar.gz")'
Supply the full path to the .tar.gz if its not in the cwd.
>
execute "Unpacking the Installer File" do
>
puts "Extracting installation File\n"
>
command "/bin/tar zxf /tmp/VMWareTools.tar.gz -C /tmp/"
>
action :run
>
end
I would have this be action :nothing with a "subscribe" meta-parameter on the
cookbook_file resource.
subscribes :run, "cookbook_file[/tmp/VMwareTools.tar.gz]", :immediately
See:
http://wiki.opscode.com/display/chef/Resources#Resources-Notifications
In both resources, you do not need the "puts" line, as Chef will display a
message about the resource it is configuring at run time.
--
Opscode, Inc.
Joshua Timberman, Director of Training and Services
IRC, Skype, Twitter, Github: jtimberman
Archive powered by MHonArc 2.6.16.