# VMWareTools-installation

**URL:** <https://discourse.chef.io/t/vmwaretools-installation/1844>\
**Category:** Chef Infra (archive)\
**Created:** [May 18, 2011, 12:45pm UTC](https://discourse.chef.io/t/vmwaretools-installation/1844 "2011-05-18T12:45:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![WEINHAPL\_Andreas](https://avatars.discourse-cdn.com/v4/letter/w/8baadc/32.png) [@WEINHAPL\_Andreas](https://discourse.chef.io/u/WEINHAPL_Andreas)\
**Post date:** [May 18, 2011, 12:45pm UTC](https://discourse.chef.io/t/vmwaretools-installation/1844/1 "2011-05-18T12:45:56Z")

</div>

Hi all,

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.

So here are the first two codes (this will work in standalone) [it will take some time because the installation file has 130MB]

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  
execute “Unpacking the Installer File” do  
puts "Extracting installation File\n"  
command "/bin/tar zxf /tmp/VMWareTools.tar.gz -C /tmp/"  
action :run  
end  
After that I will check it, and install the vmware tools.  
But if I create a role with both scripts (Copy and install) script, chef respond an error, because he didn’t copy odr extract the install file and so I can’t initialize a variable which I need to compare the versions. Dida anybody know why this happen??

Kind Regards  
Andreas

---

<div class="post-metadata">

**Author:** ![Joshua\_Timberman](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/joshua_timberman/32/424_2.png) [@Joshua\_Timberman](https://discourse.chef.io/u/Joshua_Timberman)\
**Post date:** [May 20, 2011, 11:06pm UTC](https://discourse.chef.io/t/vmwaretools-installation/1844/2 "2011-05-20T23:06:11Z")

</div>

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](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](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

---

<div class="post-metadata">

**Author:** ![Seth\_Chisamore](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/seth_chisamore/32/488_2.png) [@Seth\_Chisamore](https://discourse.chef.io/u/Seth_Chisamore)\
**Post date:** [May 21, 2011, 12:02am UTC](https://discourse.chef.io/t/vmwaretools-installation/1844/3 "2011-05-21T00:02:56Z")

</div>

Mac OS X doesn't have sha256sum but it does have openssl 🙂

openssl dgst -sha256 VMwareTools.tar.gz

Seth

--  
Opscode, Inc.  
Seth Chisamore, Senior Technical Evangelist  
IRC, Skype, Twitter, Github: schisamo

On Fri, May 20, 2011 at 7:06 PM, Joshua Timberman [joshua@opscode.com](mailto:joshua@opscode.com)wrote:

> 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](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](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

---

<div class="post-metadata">

**Author:** ![Haselwanter\_Edmund](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/haselwanter_edmund/32/635_2.png) [@Haselwanter\_Edmund](https://discourse.chef.io/u/Haselwanter_Edmund)\
**Post date:** [May 21, 2011, 8:14am UTC](https://discourse.chef.io/t/vmwaretools-installation/1844/4 "2011-05-21T08:14:53Z")

</div>

On 21.05.2011, at 02:02, Seth Chisamore wrote:

> Mac OS X doesn't have sha256sum but it does have openssl 🙂
> 
> openssl dgst -sha256 VMwareTools.tar.gz

and it has

shasum -a256 VMwareTools.tar.gz

> Seth
> 
> --  
> Opscode, Inc.  
> Seth Chisamore, Senior Technical Evangelist  
> IRC, Skype, Twitter, Github: schisamo
> 
> On Fri, May 20, 2011 at 7:06 PM, Joshua Timberman [joshua@opscode.com](mailto:joshua@opscode.com) wrote:  
> 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](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](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

--  
DI Edmund Haselwanter, [edmund@haselwanter.com](mailto:edmund@haselwanter.com), [http://edmund.haselwanter.com/](http://edmund.haselwanter.com/)  
[http://www.iteh.at](http://www.iteh.at) | [Facebook](http://facebook.com/iTeh.solutions) | [http://at.linkedin.com/in/haselwanteredmund](http://at.linkedin.com/in/haselwanteredmund)

---

<div class="post-metadata">

**Author:** ![WEINHAPL\_Andreas](https://avatars.discourse-cdn.com/v4/letter/w/8baadc/32.png) [@WEINHAPL\_Andreas](https://discourse.chef.io/u/WEINHAPL_Andreas)\
**Post date:** [May 23, 2011, 10:12am UTC](https://discourse.chef.io/t/vmwaretools-installation/1844/5 "2011-05-23T10:12:12Z")

</div>

-----Original Message-----  
From: Joshua Timberman [[mailto:joshua@opscode.com](mailto:joshua@opscode.com)]  
Sent: Samstag, 21. Mai 2011 01:06  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: VMWareTools-installation

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? =\> YES

[http://wiki.opscode.com/display/chef/File+Distribution](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")'

-\> How should I use this line? In the recipe at the sequende cookbook\_file?

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

è Many thanks, now it works ☺ I can’t know why but I think that the copy state will take to long?

See: [http://wiki.opscode.com/display/chef/Resources#Resources-Notifications](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

---

<div class="post-metadata">

**Author:** ![WEINHAPL\_Andreas](https://avatars.discourse-cdn.com/v4/letter/w/8baadc/32.png) [@WEINHAPL\_Andreas](https://discourse.chef.io/u/WEINHAPL_Andreas)\
**Post date:** [May 23, 2011, 2:37pm UTC](https://discourse.chef.io/t/vmwaretools-installation/1844/6 "2011-05-23T14:37:10Z")

</div>

Hi,

Ok I checked it and I have to say that the problem is still there ☹

Its ok if the file is copied every time, but it won't be copied ☹ It will be copied if I start the copy sequence alone, but in a role with more cookbook (cookbook role \> 1 [the cookbook alone) it won't be copied. So I didn't understand the problem ?!

Is it possible, that chef doesn't handle the cookbooks no in a order?

1.) Copy the file

2.) Extract it

3.) Install it

It looks like:  
2 .)-\> 3.) -\> 1.)

The other thing is, that I used your line  
subscribes :run, "cookbook\_file[/tmp/VMwareTools.tar.gz]", :immediately

I thought I can use it simple as it should be:  
execute "Unpacking the Installer File" do  
command "/bin/tar zxf /tmp/VMWareTools.tar.gz -C /tmp/"  
subscribes :run, "cookbook\_file[/tmp/VMwareTools.tar.gz]", :immediately  
end

but with these lines I got the error:  
/usr/lib/ruby/1.8/chef/resource.rb:293:in `subscribes': undefined method `notifies' for "cookbook\_file[/tmp/VMwareTools.tar.gz]":String (NoMethodError)

So I think I didn't use it as you mentioned in the mail before ?

Im sry but I didn't know something to get rid of this issue

Regards  
Andreas

From: Haselwanter Edmund [[mailto:edmund@haselwanter.com](mailto:edmund@haselwanter.com)]  
Sent: Samstag, 21. Mai 2011 10:15  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Re: Re: VMWareTools-installation

On 21.05.2011, at 02:02, Seth Chisamore wrote:

Mac OS X doesn't have sha256sum but it does have openssl 🙂

openssl dgst -sha256 VMwareTools.tar.gz

and it has

shasum -a256 VMwareTools.tar.gz

Seth

--  
Opscode, Inc.  
Seth Chisamore, Senior Technical Evangelist  
IRC, Skype, Twitter, Github: schisamo

On Fri, May 20, 2011 at 7:06 PM, Joshua Timberman \<[joshua@opscode.com](mailto:joshua@opscode.com)[mailto:joshua@opscode.com](mailto:joshua@opscode.com)\> wrote:  
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](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](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

--  
DI Edmund Haselwanter, [edmund@haselwanter.com](mailto:edmund@haselwanter.com)[mailto:edmund@haselwanter.com](mailto:edmund@haselwanter.com), [http://edmund.haselwanter.com/](http://edmund.haselwanter.com/)  
[http://www.iteh.at](http://www.iteh.at) | [Facebook](http://facebook.com/iTeh.solutions) | [http://at.linkedin.com/in/haselwanteredmund](http://at.linkedin.com/in/haselwanteredmund)
