Deploying VMware tools with Puppet on Linux servers

There are two possible ways to install VMware tools on Linux servers. Either you install them through the VSphere client, either you can automate this task with Puppet. VMware has provided special repositories for all the Linux distribution flavors :  VMware Operating System Specific Packages (OSPs)

Here are the main steps to complete this installation :

->Download the public keys of the VMware OSPs repositories :

rpm –import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub

rpm –import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub

->Add a  new repo for YUM in /etc/yum.repos.d/ :

cat /etc/yum.repos.d/vmware-tools.repo
[vmware-tools]
name=VMware Tools
baseurl=http://packages.vmware.com/tools/esx/5.1/rhel6/x86_64
enabled=1
gpgcheck=1

->Fetch the metapackage vmware-tools-esx-nox and it will install all the required dependencies.

Here is now an example of a working Puppet manifest to deploy and install the VMware Tools on Linux servers running RHEL 6.4  :

cat vmwaretools.pp

class vmwaretools {
        exec { “Fetching RSA key”:
        command => “rpm –import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub”,
        path => “/sbin:/bin”
        }

        exec { “Fetching DSA key”:
        command => “rpm –import http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub”,
        path => “/sbin:/bin”
        }

        exec { “Setting VMWare yum repo” :
        command => “echo -e \”[vmware-tools]\nname=VMware Tools\nbaseurl=http://packages.vmware.com/tools/esx/5.1/rhel6/x86_64\nenabled=1\ngpgcheck=1\” > /etc/yum.repos.d/vmware-tools.repo”,
        path => “/sbin:/bin”
        }

        package { “vmware-tools-esx-nox”:
          ensure => “installed”
        }
}

Do not forget to reload the puppetmaster on the server where it is located :

service puppetmaster reload

More information about VMware OSPs repositories : Read more

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s