Unattended Deployment and Configuration of OVA

Good Sys Admin is the lazy Sys Admin. Step by step IT automation is making its way in our daily activities and I like to use it as much as possible. Saving time and reducing human errors are obvious advantages, but I also like to watch how the magic happens. One press of “Enter” and everything will be done for you – not a single click of the mouse. In the spirit of IT automation, I want to share my solution for unattended deployment and configuration using an example of Runecast Analyzer. This solution can be customized for any other product that provides API for doing so.

Runecast Analyzer version 1.5.6.0 introduces a big increase in the number of available REST API endpoints. An overview can be found at Runecast API Boost article, here I’ll focus on the technical implementation.
Let’s jump to the code:

 

I’ll split and review the script in 4 parts, which you may reuse in other scenarios. Each step is marked in the code as comment, i.e #Variables – Step1#

  1. Variables
    Here are defined the variables used during deployment and configuration. Make sure to adjust them for your environment.
  2. Deploying Runecast Analyzer
    This section prepares the configuration for the appliance. Get-OvfConfiguration cmdlet will provide you with the structure of expected parameters needed for the deployment. Since we already have defined each value in the previous block, it’s easy to do the assignments here. The final step is to pass the OVA configuration along with the path to the OVA, name of the VM that will be deployed, host and datastore.
  3. Waiting for Runecast Analyzer to load
    In order to continue with the configuration, the Runecast application needs time to load. It usually takes just a couple of minutes after starting the VM. My check for running application is simply doing GET request to the main page. If we have response – Runecast Analyzer is up and running, if not – wait for 5 second and try again. In order to avoid infinite loop in case of some issue, there is a timeout set to 60 iterations (meaning roughly 5 minutes; 60 iterations with 5 seconds wait interval = 300 seconds = 5 minutes + some time spent executing the request and waiting for response).
  4. Configuration
    Once Runecast Analyzer is up the configuration can start. Each REST request against Runecast Analyzer needs to be authenticated with access token. Access token can be generated from Settings -> API Access tokens -> Generate API access token. That’s good, but I promise no clicking! Yes, there is another way introduced in the new set of endpoints: POST request to /api/v1/users/local/{username}/tokens providing description of the token (optional) and password of the account for which the token is requested. In response we get API access token which we can use in all other requests.
    Next in line is PUT request to add a vCenter Server and POST request to trigger a scan against the vCenter that was just added.
    Examples and “Try it out” option for each REST endpoint can be found in the swagger interface at Runecast Analyzer under Settings -> API Access tokens -> Runecast API

All of that put together and executed results in the following:

Now, when I log in to Runecast Analyzer web interface, my vCenter Server is added and the results of analysis are already there waiting for me:

In less than 5 minutes you have proactive monitoring solution deployed and configured. Enjoy!

The following two tabs change content below.

Ivaylo Ivanov

Ivaylo has 5 years of professional IT experience. Most of it in server administration area, network and virtualization technologies. From 2014 he specializes in VMware products family. He holds VCIX6-DCV and VCP7-CMA certifications. vExpert 2016/2017

Latest posts by Ivaylo Ivanov (see all)

About Ivaylo Ivanov

Ivaylo has 5 years of professional IT experience. Most of it in server administration area, network and virtualization technologies. From 2014 he specializes in VMware products family. He holds VCIX6-DCV and VCP7-CMA certifications. vExpert 2016/2017

Bookmark the permalink.

Comments are closed