Using Orchestrator to automatically upgrade Tools

By | March 8, 2017

One of the main challenges in every (non-small) place I’ve worked is keeping VMware Tools updated, and with Change Management processes this becomes a little bit more complicated. There is a setting on each VM to upgrade Tools when the VM is booted and this is a good way to keep Tools updated on those VMs that aren’t mission critical and require manual intervention.

In this post we’ll look at creating an action and a workflow to configure this setting, and pushing it as a context setting in the Flex Web Client.

This leads to the issue of how this setting is enabled – firstly as part of the initial push (you don’t want to enable this manually for 100’s (or more) VMs) and with newly created VMs. Although this can be set on a VM template or “Gold Build” (or equivalent terminology), this can still lead to human error so we’ll also look creating a workflow to set this for a cluster and scheduling this using the Flex Web Client.

Upgrade Tools Action

To configure a VM to upgrade Tools we need to create a new configuration specification and set the tools configuration appropriately. Our action will return the Task for the configuration (note: this can be null) and will take two inputs – the VM to configure and whether we are automatically upgrading Tools. Here is a screenshot of the action configuration:

vco-automatically-upgrade-tools-action-parameters

The script of the action is as follows:

In the code snippet above, we ensure that the “vm” variable contains a valid VM. We create a new ToolsConfigInfo object which will contain the tools settings that we wish to apply and then create a new VirtualMachineConfigSpec object and assign the ToolsConfigInfo object to it. Thus when we call the reconfigVM_Task() function with the configuration object, the VM is only reconfigured with the settings we have provided.

Now we have an action, we can create a workflow that will invoke it and then wait for the task to complete. This is the schema diagram:

vco-automatically-upgrade-tools-workflow-schema

The workflow (and action) can be downloaded from the file at the end of this post.

Cluster Workflow

Now we have an action to make the changes, we can put together a workflow that will look at all VMs in the cluster and configure them. The schema is as follows:

The workflow will get all VMs in the cluster and for each one:

  • Only upgrade Windows VMs (“Upgrade VM ?” decision)
  • Check if the configuration setting currently matches what we want it to. (“Decide setting” script).
  • Change the setting.

The meat of the process is in the “Decide setting” script item – we will look at what the setting should be, and if the current setting does not match then we will change it. This also means that if we wish the VM to update Tools manually and it is set to automatically update at power on, the setting will be changed to update manually.

Setting as a context action

To set this as a context action on the cluster within the Flex Web Client, we need to look at the Orchestrator pages in the Web Client. The server page will have a Manage screen and a Context Actions page:

Next we need to add a new one – select the workflow to add and the type of object to associate it with – in this case we’re adding the workflow to set the upgrade for Tools for a single virtual machine, so we select the Virtual Machine object:

Press OK and all is done. You’ll need to reload the Flex Web Client in order to see it – it appears at the bottom of the actions menu for the object – under the “vRealize Orchestrator context actions” title.

That’s it ! This workflow a prime candidate for being scheduled to ensure all your VMs are kept up to date.

The workflows (and action) for this are available at my github repo – https://github.com/nelons/vco-content.