WARNING.  This script is to be used for informational and learning purposes only.  Should you choose to modify and or include this script in your test or production environments, you do so at your own risk.  Custom scripts are only supported by Embotics, when they are produced by an Embotics Application Architect as part of a paid service engagement.

Should you require assistance modifying or troubleshooting the script, please contact your Customer Advocate who will provide you with a quote for Professional Services.


SolarwindsIPAM is an IP address Management tool. IPAM can be integrated into vCommander to get and assign IP address on deployment for VM's in a VMware environment and remove the reserved address on decommissioning. 


Requirements

  • vCommander scripts (Download here)

  • PowerShell v4 installed on the vCommander application server

  • Embotics® vCommander® 6.1.9 or later

  • Embotics vCommander 2.8 REST API powershell libraries (Download here)

  • Solarwinds SDK installed for Orion IPAM 4.6.0
  • SolarwindsIPAM Version 4.6.0 or higher can be downloaded from SolarWinds

 


Prepare the Script Files

        

Download and extract the scripts 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.


Setting
Description
$vCommanderURL
The Web URL of the vCommander server.
$CredFile
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.
$hostname
FQDN of your Solarwinds server. This value must be resolvable via DNS and reachable from the vCommander application server.
$SWCredfile
The credentials file which handles access to your IPAM Server. For more details, please refer to the Appendix: PowerShell Script Credential Encryption in the vCommander API Getting Started Guide, available here.
$ModulePath
Module Path for the SolarWinds IPAM SDK Powershell DLL


Note: Your Environment may require additional or different logic depending on how IPAM has been configured. This example requires the “Service Type” attribute is configured in the script logic to set the correct network. 

 

The SW_Get.ps1 has sample logic to ensure that production goes to the production portgroup when deploying through vCommander. You can edit this logic for any combination as long as there is a match in IPAM for the name of the portgroup and the displayname field for a subnet. 



Update Approval Workflow


Now that the scripts and credentials have been configured it's time to update the approval workflow to call out to IPAM 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 with Static drop downs for "Production, Development,and QA"

 

Sample Form:


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

 

powershell.exe c:\Scripts\solarwinds\SW_GetIP.ps1 -RequestID "#{request.id}" -ServiceType "#{request.services[1].settings.customAttribute['Service Type']}"



That's all there is to assigning an IP from SolarWindsIPAM. 

 

Update Decommissioning Workflow

Now to configure vCommander to remove the assigned address when the service is decommissioned through vCommander. 

 

Edit your completion workflow that's tied to your decommissioning change request form. 



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

    

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

 

Now Request a VM as a test if everything was configured properly you will see an entry in IPAM for the newly created VM and the Customized VM will have the correct network information assigned. 

 

New address assigned in Solarwinds IPAM: 


Final Step: Verify the Deployed VM has the correct information.