Every now and then there is still a need to deploy physical server and workstation images.  Maybe it's from a legacy PXE boot server in your environment you want to utilize to deploy the same legacy apps until you've had time to build the proper templates in the virtual environment, or just want to put a bit of control around what users can do with an extra request layer with approvals. In this example we are going to show you exactly that, we have a PXE boot server called FOGProject (https://fogproject.org) which we will configure a custom form and attributes to only give users access to the images they need to be able to deploy instead of the whole list that's been built up over the years on the sever and don't apply to them. 


Requirements

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.


Setting
Description
$FogApiToken
This can be found in Fog Configuration> Fog Settings> API System
$FogUserToken
The Fog User token can be found by selecting a user to edit and selecting API settings from the left menu.
$FogServer
The IP address or Dns name of the fog server
$Description
Description to tag to every host created in fog so admin's know where the entry originated from in the system.


Creating Custom Attributes


Now that the script is in place and configured we need to create the attributes for the unmanaged component form that the user will see when making a request to image a machine. 


Mac Address Atttribute:

  • Under the Configuration menu, choose Custom Attributes. Click Add.
  • Uncheck Edit in Service Portal. Click Next.
  • Name the attribute "MAC Address" and provide a meaningful description such as "Machine mac address for deployment"
  • Select Applies To: Form and Type: Text. Click Next. 
  • On the configure attribute section select the Specific Format Radial button
  • In the regex field enter ^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$ and set a validation message of "Please provide a valid mac in the form of - 00:00:00:00:00:00"


Name Attribute:

  • Under the Configuration menu, choose Custom Attributes. Click Add.
  • Name the attribute "Name" and provide a meaningful Description.
  • Select Applies To: Form and Type: Text.
  • Uncheck Edit in Service Portal. Click Next. and Finish


Image Attribute:

  • Under the Configuration menu, choose Custom Attributes. Click Add.
  • Name the attribute "Image" and provide a meaningful Description such as "Pxe Boot image to assign to the host entry"
  • Select Applies To: Form and Type: List.
  • Uncheck Edit in Service Portal. Click Next
  • In the list add the names of only the images you want users to be able to request as they appear in your Pxe Server. 
  • Select Finish


Configure the Service Catalog Item


Now to put the final pieces together so users will have the option in the catalog to setup a PXE deployment task on the Fog Server. 

  • In vCommander Admin portal select Configuration > Service Request Configuration > Service Catalog
  • Select, Add Service
  • Give the service an meaningful name, we used "Deploy Physical Server from Image" 
  • If you would like to give it a custom Image and make a category for it that can be done here as well. Select Next
  • Select Add on the component blueprint screen and choose "Unmanaged Component form" give it an appropriate name. 
  • Set a description you would like users to see it on the form. 
  • Under Compltion Workflow select "Add Workflow" under steps Select Add > Execute Script. 
  • Give the step an appropriate name, in the Command Line Tesxt box enter the following Syntax: 
    • powershell.exe c:\Scripts\fogproject\DeployImage.ps1 -MachineName "#{target.settings.customAttribute['Name']}" -MacAddress "#{target.settings.customAttribute['MAC Address']}" -imagename "#{target.settings.customAttribute['Image']}"

  • Select, Next to get to the Summary Screen and then Finish to close the Add Completion Workflow wizard. 
  • On the Attributes Tab add the 3 Attributes that you created for this service request form.
  • Select the Form Tab and add the 3 attributes from the toolbox on the right hand side of the screen.
  • If you would like to add descriptive text before or after any field enter it here with the Text toolbox item. 
  • Select, Next until you get to the Visability Section, Set the users and or organizations that you would like to have access to it.

  • On the Summary Screen select Finish to complete setup of the Service Catalog item. 



Test the Request



In the portal test the service with a Portal user with the appropriate rights to see the catalog item and perform a request. 



Reboot the target Server to see the imaging task start: