Automating VM Customization through Workflows: Examples

This article provides examples of using workflow steps to automate the VM customization process. The first example involves fewer changes to your process; the other provides more flexibility.

In our example company:

BlueCat™ IPAM is used for address management, with static DNS. (To learn how to integrate with BlueCat™, see Integrating BlueCat™ IP Address Management with vCommander.)

VMware customization specs are currently used to join the VM to a domain, using one customization spec for each domain. The customization specs are currently set to prompt for the IP address.

VMware customization specs are also used to configure networking.

The customization process is also used to run a Windows batch script to install software on deployed VMs.

NotePencil-smallIn these examples, we mention only the non-default settings.

Solution 1: Fewer changes to existing process

In this example, there are no changes to customization specs, but the solution is less flexible. You would need to set up a workflow for both Windows and Linux, but we show only the Windows example here.

Edit the service catalog entry

To edit a service catalog entry so that it no longer uses a customization spec, do the following:

1.Go to Configuration > Service Request Configuration, and click the Service Catalog tab.

2.Click Edit for the appropriate service catalog entry, then under the Component Blueprints, select the appropriate service catalog component.

3.From the Customization Spec menu, choose None.

4.Click Finish.

Edit Service in Catalog
Create a component-level completion workflow

1.Go to Configuration > Service Request Configuration, click the Completion Workflow tab, then click Add.

2.In the Completion Workflow Configuration dialog, type a name for the workflow, then from the Apply this Workflow menu, choose After a VM is deployed, and click Next.

On the Steps page that displays, you will add actions to the workflow.

3.To wait for the IP address and DNS name to be assigned to the deployed VM, do the following:

Click Add > Wait For Event.

In the details pane, name the step "Wait for IP and DNS", then use the default values except from the Wait For menu, choose Service to obtain IP address and DNS name.

Wait For Event
NotePencil-smallFor Windows VMs, it may take longer than the default 300 seconds (five minutes) to obtain an IP address and DNS name. So you may want to use two steps: one that waits for guest OS customization to complete, and one that waits for IP address and DNS name.

4.To make a call to BlueCat™ to obtain the IP address and assign network settings, click Add > Guest OS > Configure OS Networking, then do the following in the details pane:

Name the step "Configure BlueCat Networking".

From the Credentials menu, choose credentials, or click Add Credentials. See Configuring OS Networking through a Workflow Step for guidance.

From the Assign IP menu, choose From BlueCat™ IPAM.

From the Action menu, choose Reserve Only. This setting causes the IP information to be recorded in the approval comments. (Choosing Apply Settings, as shown in the next example, causes the settings to be applied as part of the workflow step.)

Enter networking details as required. The Gateway, DNS View, Block, Network and Domain Name fields are mandatory.

Config Networking

5.To power off the VM, click Add > Perform Power Action, then do the following in the details pane:

Name the step "Stop VM".

From the Action menu, choose Stop.

Perform Power Action Step

6.To wait for the VM to power off, click Add > Wait For Event, then do the following in the details pane:

Name the step "Wait for power off".

From the Wait For menu, choose Service to power off.

Wait For Event Step Details

7.To run a customization process, click Add > Guest OS > Customize VM, then in the details pane, from the Customization Spec menu, choose the appropriate customization spec.

Customize VM Step Details

8.To wait for the customization process to complete, click Add > Wait For Event, then do the following in the details pane:

Name the step "Wait for customization".

From the Wait For menu, choose Guest OS customization to complete.

From the Wait Time menu, enter at least 1800 seconds for Windows (the default 300 seconds is appropriate for Linux).

Wait For Event Step Details

 

9.To wait for the IP address and DNS name to be assigned to the deployed VM, click Add > Wait For Event, then do the following in the details pane:

Name the step "Wait for IP and DNS 2".

From the Wait For menu, choose Service to obtain IP address and DNS name.

Wait For Event Step Details

10.To send an email to inform people that the VM is ready, click Add > Send Email, then do the following in the details pane:

In the Address List field, enter one or more email addresses (separate multiple addresses with semicolons).

Optionally, enter a custom subject line.

Enter text in the email body.

Send Email Step Details

11.Now that you've added all of the workflow steps, click Next.

12.On the Assigned Components page, assign this workflow to the proper service catalog entry.

13.Click Next and Finish.

Solution 2: More flexibility

In this example, you modify customization specs, using workflow steps to do more of the customization work.

Integrate vCommander with BlueCat™

Create credentials and connect vCommander to a BlueCat™ server as detailed in Integrating BlueCat™ IP Address Management with vCommander.

Modify your customization specs

Edit your customization specs so that:

the IP address is set to 1.1.1.1, instead of prompting for the IP address

the VM is not joined to a domain

Assign customization specs to the proper service catalog entries

1.Go to Configuration > Service Request Configuration, and click the Service Catalog tab.

2.Edit the service catalog entry, and on a Component Blueprints page, make a selection from the Customization Spec menu.

3.Click Edit for the appropriate service catalog entry, then under the Component Blueprints, select the appropriate service catalog component and make a selection from the Customization Spec menu.

4.Click Finish.

Create a component-level completion workflow

1.Go to Configuration > Service Request Configuration, and click the Completion Workflow tab, then click Add.

2.In the Completion Workflow dialog, give the workflow a name, from the Apply this Workflow menu, choose After a VM is deployed, then click Next.

3.Now we're going to add actions to the workflow. First we need to wait for customization to complete.

On the Steps page, click Add > Wait For Event, then do the following in the details pane:

Name it "Wait for Sysprep to Complete".

From the Wait For menu, select Guest OS customization to complete.

In the Wait Time field, enter the amount of time for the event to complete. at least 900 seconds for Windows (the default 300 seconds is appropriate for Linux).

NotePencil-smallFor Linux, the default of 300 seconds (five minutes) is appropriate. for Windows VMs, it may take longer than the default 300 seconds to obtain an IP address and DNS name. 900 seconds is a good wait time to use. You may also want to use two steps: one that waits for guest OS customization to complete, and one that waits for IP address and DNS name.
Wait for Event Step Details

4.To wait for the VM to power on, click Add > Wait For Event, then do the following in the details pane:

Name the step "Wait for power on".

From the Wait For menu, choose Guest OS to power on.

Wait For Event Step Details

5.To make a call to BlueCat™ to obtain the IP address and assign network settings, click Add > Guest OS > Configure OS Networking, then do the following in the details pane:

Name it "BlueCat Networking".

From the Credentials menu, choose credentials or click Add Credentials. See Configuring OS Networking through a Workflow Step for guidance.

From the Assign IP menu, choose From BlueCat™ IPAM.

In the Action menu, we will leave the default setting, Apply Settings. You can also select Reserve Only (as shown in the previous example) to have the IP information recorded in the approval comments. When you select Reserve Only, the output can be used as input to a subsequent Customize VM step in the workflow.

Enter networking details as required. The Gateway, DNS View, Block, Network and Domain Name fields are mandatory.

Configuring Network Details

6.To wait for 30 seconds, click Add > Wait For Event, then do the following in the details pane:

Name the step "Wait for 30".

From the Wait For menu, choose Time to elapse.

For Wait Time, type 30.

Wait For Event Step Details

 

7.To join the VM to the Windows domain, click Add > Guest OS > Join Domain, then do the following in the details pane:

Specify guest OS credentials and leave the Restart Guest OS option enabled.

Enter a domain name and select the appropriate domain credentials.

Join Domain step

 

8.To wait for IP address and DNS name assignment, click Add > Guest OS > Wait for Event, then do the following in the details pane:

Name the step "Wait for IP and DNS".

From the Wait For menu, choose Service to obtain IP address and DNS name.

NotePencil-smallFor Windows VMs, it may take longer than the default 300 seconds (five minutes) to obtain an IP address and DNS name. You may want to use two steps: one that waits for guest OS customization to complete, and one that waits for IP address and DNS name.
Wait For IP and DNS step

 

9.To give the PV domain group permissions on the deployed VM, click Add > Guest OS > Run Program, then do the following in the details pane:

Name it "Grant PV permissions".

From the Credentials menu, choose credentials, or click Add Credentials. See Configuring OS Networking through a Workflow Step for guidance.

In the Command Line field, enter a command for granting permissions.

Run Program step

10.To run a script that installs Microsoft Security Essentials on the deployed VM, click Add > Guest OS > Run Program, then do the following in the details pane:

Name the step "Install software".

From the Credentials menu, choose credentials, or click Add Credentials. See Configuring OS Networking through a Workflow Step for guidance.

In the Command Line field, enter a command for installing software.

Run Program step

11.Now that we've added all the steps, click Next.

12.On the Assigned Components page, assign the workflow to the proper service catalog entry.

13.Click Next, then Finish.