[chef] VMWareTools-installation


Chronological Thread 
  • From: WEINHAPL Andreas < >
  • To: " " < >
  • Subject: [chef] VMWareTools-installation
  • Date: Wed, 18 May 2011 14:45:56 +0200
  • Accept-language: en-US, fr-FR
  • Acceptlanguage: en-US, fr-FR

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

 

 

 

 

# Check if the right OS is running
case node[:platform]
  when "debian", "ubuntu"
    # Check if VMwareTools are installed before
    if Dir["/usr/bin/vmware-config-tools.pl"] != []
      puts "VMWaretools found. Checking Version for installationn"
      SRC="/usr/bin/vmware-config-tools.pl" #this is the local one
      SRC2 ="/tmp/vmware-tools-distrib/vmware-install.pl" #this is the 
installation file
      FRST = File.read(SRC).grep(/buildNr = /)[0].gsub(".", 
"").split[2].gsub("'", "") #creating a version number e.g. 400 [4.0.0]
      SECD = File.read(SRC2).grep(/buildNr = /)[0].gsub(".", 
"").split[2].gsub("'", "") #creating a version number e.g. 837 [8.3.7]
      DIFF = FRST.to_i-SECD.to_i
      if DIFF > 0
        puts "You can't install an older VMWareTool version, please check the 
Version\n"
      elsif DIFF < 0
        puts "Your local version is older, upgrade to newer one\n"
#       execute "\nInstalling the VMWare Tools (silent mode with defaults)\n" 
do
#         command "/tmp/vmware-tools-distrib/vmware-install.pl -d"
#           action :run
#         end
      else DIFF == 0
          puts "You have the newest version of VMWareTool\n"
      end
    else
      puts "NO VMWaretools found. Beginn with installation\n"
#        # Install the VMWareTools silent
#        execute "\nInstalling the VMWare Tools (silent mode with 
defaults)\n" do
#          command "/tmp/vmware-tools-distrib/vmware-install.pl -d"
#          action :run
#        end
    end
  else
    puts "THIS IS A WRONG OS, NEEDED OS => DEBIAN/UBUNTU \n"
end



Archive powered by MHonArc 2.6.16.

§