How to Creaste an Automated Process to deploy a new virtual machine

How to Create an Automated Process to Deploy a New Virtual Machine

How to Creaste an Automated Process to deploy a new virtual machineIn this tutorial, you will learn how to deploy a new virtual machine using Ayehu eyeShare VMware vSphere Integration. We’ll see how to use IT process automation by sending eyeShare an email with an excel attachment that includes the necessary virtual machine specs (of course you can customize this process as you wish).

How to Create an Automated Process to Deploy a New Virtual Machine – Let’s start with a new workflow!

Since we’re sending the virtual machine specs to eyeShare using an excel attachment, eyeShare saves the file on the local server. We’ll use the “attachment list” action to retrieve the attached file details. Use a “wildcard” to view all attachments, and the “get cell value” action to extract the file path from the previous action result. Each action contains a variable, which is listed under the action name. This variable can be used as the input of any of the following actions. That variable should be wrapped by a percent sign (%) on either side.

Use the attachment list result as the input of the “get cell value” action. Change the action name to “file path” for future use. Next, let’s read the excel file from the local server using the “read excel” action. Enter the file path variable. The excel data should contain 4 parameters:

  • The desired virtual machine name
  • CPU number
  • Memory size
  • Disk space
Extracting Details from the Excel File
  • Use the “get cell value” action to extract each of the parameters
  • Enter the result set name
  • Enter the row number and column number
  • Change the action name to “VM name”, for future use

Do the same for CPU number, memory size and disk space. Make sure to enter the relevant column number in each action. That way you can add additional parameters to your excel file.

Creating Configuration Spec

Use the “VM Create Configuration Spec” action. Keep in mind that this step is optional and you can always use an existing spec. Now, in order to execute an operation on your vCenter, you need to define it for the first time as a device in eyeShare.

  • Enter the vCenter IP address, username and password
  • Select your vCenter platform. (From now on, we’ll use the vCenter for all VM activities.)
  • Enter the registration details, and the new specification name
  • Enter the administrator password
Creating the Virtual Machine
  • Choose the “create from template” action.
  • Select the vCenter device that you defined earlier
  • Choose the template, and enter the virtual machine name variable that was extracted from the excel file
  • Enter the new specification name that you just created (this field is optional)
Defining New Virtual Machine Attributes

Start with the “VM modify CPU” action that defines the CPU’s number on our new VM.

  • Select your vCenter
  • Enter the VM name variable, and enter the CPU’s number variable
  • Modify the memory using the “VM modify memory” action
  • Select your vCenter, enter the VM name variable, and the memory size variable
  • Resize the VM disk using the “resize VM disk” action
  • Select your vCenter
  • Enter the VM name variable, the disk name, and the disk size variable
Take a Snapshot

Before powering on your virtual machine, it’s a good idea to first take a base snapshot.

  • Use the “VM create snapshot” action to create a snapshot of our new VM
  • Select your vCenter
  • Enter the VM name variable
  • Type in the snapshot name and a snapshot description
  • Use the “VM info” action to view our new VM’s current details
  • Select your vCenter
  • Enter the VM name variable
Power Up!

And now, at last, it’s time to finally power on your shiny new VM using the “VM power on” action.

  • Select your vCenter
  • Enter the VM name variable. (To view a list of all of your machines, including the new one, you can use the “VM list” action.)

The last step is sending a confirmation email to the system administrator using the “send email” action. Select a recipient and enter the message subject and body. When that’s done, save the workflow and enter its name.

Remember, your workflow is going to be triggered by an email, so you need to create a relevant action rule. Create the new rule by pressing the “new” button. Enter the rule name, and create a new condition. The condition determines when the workflow should be initiated.  In this case, it will be based on the arrival of an incoming message. So, let’s create a source that will trigger the workflow. Add the first element to the condition. The second element of the condition will be the message subject. It should contain a certain phrase. In this case, let’s use “deploy new Virtual Machine”

Define the workflow as having to meet two conditions. If you select the “and” condition, your workflow will be initiated only when eyeShare receives an alert from admin@ayehu.com and it phrase the “deploy new VM”. Select the workflow to be initiated (the one you just created). Press “add” and save the rule.

To try it out, send an email to eyeShare (@your organization.com) with that magic phrase in the subject and with the excel attachment. Then, watch the eyeShare active logs in order to track the workflow progress.  Each action returns a result, which we can see in the log. You should be able to see your new VM among the virtual machines list. Finally, you should see the email sent by eyeShare at the end of the process, which, of course, can be fully customized.

Now you can check your new VM details at the VM Center console





IT Process Automation Survival Guide