This article provides a solution for the automatic tear down and redeployment of a vCommander service based on a vCenter vApp using the Embotics vCommander REST API. In this example, Windows Task Scheduler on the vCommander application server is used as the scheduling mechanism, but any equivalent product on any system that can access the vCommander API will also work.


Requirements



Preparing the Service


The service that will be deployed by this solution must either be configured one of two ways:


  • with a single Virtual Service (vApp) component


  • or with one or more components configured to deploy as a Virtual Service (vApp)


Additionally, it's recommended that you create a local vCommander user specifically for automation purposes. This way, you can make this type of service unavailable to users who might otherwise request it in error.




Creating the Scheduled Task


  1. Download the script and extract to a location on the vCommander server. In this example, we use c:\scripts.
  2. Login to the vCommander application server as a Windows administrator and launch Task Scheduler.
  3. In the Actions pane, click Create Basic Task.
  4. Provide a Name and Description. Click Next.

  5. Choose the Trigger. Click Next.


  6. Set additional scheduling options.


  7. Choose Start a program as your action. Click Next.


  8. Configure the next page as follows:
  • Program/script:  c:\scripts\vApp_Automation.ps1
  • Add Arguments: -vCommanderServer 'your.vcommander.com' -VappName 'Classroom Two' -vCredFile 'c:\scripts\superuser.xml' -LogfileLocation 'c:\scripts\VappAutomation.log'



    The arguments provide the following information:

    vCommanderServer: The FQDN or IP address of the vcommander server
    VappName: The name of the service to deploy, as it appears in vCommander's Service Catalog.
    vCredFile: The location of the encrypted credentials file
    LogfileLocation: The location of the file to which information and errors will be logged

    Click Next then click Finish.