InfoBlox is an IP address management tool which can be integrated into vCommander to get and assign IP address when deploying new VM's in an VMware environment and remove the address when decommissioning the VM. 


Prepare the Script Files

Download and extract the script to your vCommander application server. Embotics recommends storing all scripts called by vCommander in a single location (c:\Scripts) for example. These scripts are executed by vCommander. With the scripts extracted, the file system will look like this:

The scripts require minor editing before they will work with your systems. Refer to the comments in the individual script or the table below for guidance on editing the contents.

The Web URL of the vCommander server.
The credentials file which handles access to your vCommander. For more details, please refer to the Appendix: PowerShell Script Credential Encryption in the vCommander API Getting Started Guide, available here.
The vCenter Server name as it appears in vCommander. This value must be resolvable via DNS and reachable from the vCommander application server.
The Base64 encoded username and password for the InfoBlox system in the form username:password

Note: Your Environment may require additional or different logic depending on how InfoBlox has been configured.

Create Custom Attribute

The script to reserve a new IP address requires you to identify the InfoBlox network that the IP address will be part of. To pass this into the request a Custom Attribute needs to be created.

First, create a new custom attribute in vCommander named "Service Type".

Set the Type to List and set the Applies To parameter to All Types. Check the Edit in Service Portal option and click Next.

Add entries to the list. Add one entry for each of the InfoBlox Networks you want to be able to select from. Make sure that the values entered here match the Comment field of the Networks in InfoBlox. For example, if i want to be able to target a specific Network where the Comment field equals "Infoblox Network" then I would add an entry of "Infoblox Network" here in the custom attribute.

Once the networks have been added, click Finish to save the Custom Attribute.

Update Approval Workflow

Now that the scripts and credentials have been configured it's time to update the approval workflow to call out to InfoBlox and Assign IP addresses for each VM in the request based on a Service Form attribute. In this example we use a "Service Type" form attribute which is the Custom Attribute we created earlier where you select the name of the Network you want to select the IP address from.

Sample Form:

Adding a step to call the script on a new request with the following command line syntax:

powershell.exe c:\Scripts\infoblox\infobloxs_GetNextIP.ps1 -RequestID "#{}" -ServiceType "#{[1].settings.customAttribute['Service Type']}"

Now, when the VM approval workflow is processed an IP will be reserved from the InfoBlox system for that VM and applied to that VM at time of creation.

Update Decomissioning Workflow

Next, we need to configure vCommander to remove the assigned address when the service is decommissioned. To do that we will use a completion workflow which is set to execute when the decommissioning service request is performed.

First, edit the completion workflow that's tied to your decommissioning change request form. 

Add an execute script step to remove the IP from phpIpam before your delete vm step with the following commandline syntax: 


            powershell.exe c:\Scripts\InfoBlox\InfoBlox_releaseIP.ps1 -IPAddress "#{target.ipv4Addresses}"

Now vCommander will automatically remove the reserved IP from InfoBlox when you decomission the VM.

Perform a Test Request

To test these changes we need to request a VM. If everything was configured properly you will see an entry in InfoBlox for the newly created VM and the customized VM will have the correct network information assigned. 

First, check that the InfoBlox system has a reserved IP in the network you selected:

Then, verify the IP of the VM in vCommander