Automate VM Customization through Workflows

This topic 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 Integrate BlueCat™ IP Address Management.)
  • 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.

In these examples, only the non-default settings are mentioned.

IMPORTANT: The first step in a component-level completion workflow for a new VM should be a Wait for Guest OS to Power On step, so that variables such as IP addresses have values before other steps are run. For 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.

Solution 1: Fewer changes to existing process

Although there are no changes to customization specs, this solution is less flexible. With this solution, you need to set up a workflow for both Windows and Linux. The example below shows the setup for Windows only.

Edit the service catalog entry

You will edit a service catalog entry so that it no longer uses a customization spec.

  1. Go to Configuration > Self-Service, and select the Catalog tab.
  2. Click Edit for the appropriate service catalog entry, then under Component Blueprints, select the applicable service catalog component.
  3. On the Infrastructure tab, from Customization Spec, select None.

    Edit Service in Catalog

  4. Click Finish.

Create a component-level completion workflow

  1. Go to Configuration > Self-Service, click the Completion tab.
  2. On the Workflows page, click Add.
  3. In the Completion Workflow Configuration dialog, do the following:
    1. In the Name field, enter a name for the workflow.
    2. From the Apply this workflow drop-down list, select after a VM is deployed.
    3. Click Next.
  4. To wait for the IP address and DNS name to be assigned to the deployed VM, do the following:
    1. In the Step Order section, click Add > Wait For Event.
    2. In the Wait For Event step details section:
      • For the Step Name, enter "Wait for IP and DNS".
      • For Wait For, select Service to obtain IP address and DNS name.

      Wait for Event Step Details

      For 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.

  5. To make a call to BlueCat™ to obtain the IP address and assign network settings, do the following:
    1. In the Step Order section, click Add > Guest OS > Configure OS Networking.
    2. In the Configure OS Networking step details section:
      • For the Step Name, enter "Configure BlueCat Networking".
      • For Credentials drop-down, select the applicable credentials or click Add Credentials. See Prerequisites for guidance.
      • For Assign IP, select FromBlueCat™ IPAM.
      • For Action, select Reserve Only. This setting records the IP information in the approval comments.

        If you select Apply Settings (as shown in the next solution), the settings are 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

  1. To power off the VM, do the following:
    1. In the Step Order section, click Add > Perform Power Action.
    2. In the Perform Power Action step details section:
      • In the Step Name field, enter "Stop VM".
      • For Action, select Stop.

      Perform Power Action Step

  2. To wait for the VM to power off, do the following:
    1. In the Step Order section, click Add > Wait For Event.
    2. In the Wait For Event Step Details section:
      • In the Step Name field, enter "Wait for power off".
      • For Wait For, select Service to power off.

      Wait For Event Step Details

  3. To run a customization process, do the following:
    1. In the Step Order section, click Add > Guest OS > Customize VM.
    2. In the Customize VM step details section:
      • For Step Name, enter "Customize VM".
      • For Customization Spec, select the appropriate customization spec.

      Customize VM Step Details

  4. To wait for the customization process to complete, do the following:
    1. In the Step Order section, click Add > Wait For Event.
    2. In the Wait for Event step details section:
      • For Step Name, enter "Wait for customization".
      • For Wait For, select Guest OS customization to complete.
      • For Wait Time, enter at least 1800 seconds for Windows (the default 300 seconds is appropriate for Linux).

      Wait For Event Step Details

  5. To wait for the IP address and DNS name to be assigned to the deployed VM, do the following:
    1. In the Step Order section, click Add > Wait For Event.
    2. In the Wait For Event step details section:
      • For Step Name, enter "Wait for IP and DNS 2".
      • For Wait For, select Service to obtain IP address and DNS name.

      Wait For Event Step Details

  6. To send an email to inform people that the VM is ready, do the following:
    1. In the Step Order section, click Add > Send Email.
    2. In the Send Email step details section:
      • For Address List, enter one or more email addresses (separate multiple addresses with semicolons).
      • For Email Subject, enter a subject.
      • For Email Body, enter the required information.

      Send Email Step Details

  7. Now that you've added all of the workflow steps, click Next.
  8. On the Assigned Components page, do the following:
    1. Select Apply this workflow to the selected components, then select the components that you want to apply the workflow to.
    2. Click Next.
  9. On the Summary page, do the following:
    1. For Description of Changes, enter details about the workflow.
    2. Click Finish.

Solution 2: More flexibility

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

Integrate Commander with BlueCat™

Create credentials and connect Commander to a BlueCat™ server as detailed in Integrate BlueCat™ IP Address Management.

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 isn't joined to a domain.

Assign customization specs to the proper service catalog entries

  1. Go to Configuration > Self-Service, and click the 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 > Self-Service, and click the Completion tab, then click Add.
  2. In the Completion Workflow Configuration dialog, do the following:
    1. In the Name field, enter a name for the workflow.
    2. From the Apply this Workflow drop-down, select after a VM is deployed.
    3. Click Next.
  3. To wait for customization to complete, do the following:
    1. In the Step Order section, click Add > Wait For Event.
    2. In the Wait For Event step details section:
      • For Step Name, enter "Wait for Sysprep to complete".
      • For Wait For, select Guest OS customization to complete.
      • In the Wait Time field, enter the amount of time for the event to complete. For Windows, enter at least 900 seconds. For Linux, the default 300 seconds is appropriate.

      Wait for Event Step Details

      For Windows VMs, 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 wait for the VM to power on, do the following:
    1. In the Step Order section, click Add > Wait For Event.
    2. In the Wait For Event step details section:
      • For Step Name, enter "Wait for power on".
      • For Wait For, select 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, do the following:
    1. In the Step Order section, click Add > Guest OS > Configure OS Networking.
    2. In the Configure OS Networking step details section:
      • For Step Name, enter "Configure BlueCat Networking".
      • For Credentials, select credentials or click Add Credentials. See Configure OS Networking Through Workflow Steps for guidance.
      • For Assign IP, select From BlueCat™ IPAM.
      • For Action, select Apply Settings.

        If you select Reserve Only (as shown in the previous solution), the IP information is recorded in the approval comments. 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, do the following: 
    1. In the Step Order section, click Add > Wait For Event.
    2. In the Wait For Event step details section:
      • For Step Name, enter "Wait for 30 seconds".
      • For Wait For, select Time to elapse.
      • For Wait Time, enter "30".

      Wait For Event Step Details

  7. To join the VM to the Windows domain, do the following:
    1. In the Step Order section, click Add > Guest OS > Join Domain.
    2. In the Join Domain step details section:
      • For Step Name, enter "Join to Windows domain".
      • For Guest OS Credentials, select the applicable credentials or click Add Credentials.
      • 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, do the following:
    1. In the Step Order section, click Add > Guest OS > Wait for Event.
    2. In the Wait For Event step details section:
      • For Step Name, enter "Wait for IP and DNS".
      • For Wait For, select Service to obtain IP address and DNS name.

      Wait For IP and DNS step

      For Windows VMs, 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.

  9. To give the PV domain group permissions on the deployed VM, do the following:
    1. In the Step Order section, click Add > Guest OS > Run Program.
    2. In the Run Program step details section:
      • For Step Name, enter "Grant QA permissions".
      • For Credentials, select the appropriate credentials or click Add Credentials. See Configure OS Networking Through Workflow Steps for guidance.
      • For Command Line, enter a command for granting permissions.

      Run Program step

  10. To run a script that installs Microsoft Security Essentials on the deployed VM, do the following:
    1. In the Step Order section, click Add > Guest OS > Run Program.
    2. In the Run Program step details section:
      • For Step Name, enter "Install software".
      • For Credentials, select the applicable credentials or click Add Credentials. See Configure OS Networking Through Workflow Steps for guidance.
      • For Command Line, enter a command for installing software.

      Run Program step

  1. Now that you've added all of the workflow steps, click Next.
  2. On the Assigned Components page, do the following:
    1. Select Apply this workflow to the selected components, then select the components that you want to apply the workflow to.
    2. Click Next.
  3. On the Summary page, do the following:
    1. For Description of Changes, enter details about the workflow.
    2. Click Finish.