VMware Cloud Community
seangadson
Contributor
Contributor
Jump to solution

Deploy ovf/ova with vRO Script or vSphere API

Hello All,

I was wondering is there a way to do automatic deployments (imports) of ovf/ova files with just JavaScript or with the vsphere API?  I know there is a plugin but I am worried about the ongoing support so I was wondering if anybody leveraged any other solutions

Reply
0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Yes, assuming it is copied on the file system of vRO appliance in a directory the vRO scripting has execution permissions for, you should be able to run it using Command scripting class (check vRO API Explorer for documentation about this scripting class).

View solution in original post

Reply
0 Kudos
9 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

One possible option could be the official VMware OVF Tool - https://code.vmware.com/web/tool/4.3.0/ovf

Reply
0 Kudos
seangadson
Contributor
Contributor
Jump to solution

Can you call this tool from vRO?

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Yes, assuming it is copied on the file system of vRO appliance in a directory the vRO scripting has execution permissions for, you should be able to run it using Command scripting class (check vRO API Explorer for documentation about this scripting class).

Reply
0 Kudos
seangadson
Contributor
Contributor
Jump to solution

So just so I am understanding what you are saying could be a good solution is to use the ovftool, download the linux version, install it in a place where vRO has execution permissions for and then use the command scripting class? 

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Yes, something like that.

An alternative approach to using the ovftool is to try to deploy OVF from vCenter Content Library, utilizing vRO vAPI plug-in. Check for example the following thread https://communities.vmware.com/thread/558854 which could be a good starting point. But this is likely more complex approach and will require more code than the simple execution of ovftool.

seangadson
Contributor
Contributor
Jump to solution

Thanks a lot this will give me two options as I work with the customer.  I was able to install the ovftool though and I am able to run commands so I am going to lead towards that way

Reply
0 Kudos
seangadson
Contributor
Contributor
Jump to solution

Hey,

I have a question I am getting a 255 result code when I try and run the ovftool commands:

Code:

// Prepare Command line and parameters to execute:

cmd = "ovftool --help";

System.log("executing cmd: " + cmd);

// Create and execute the command:

var command = new Command(cmd);

command.execute(true);

// Display command results and output

var scriptResult = command.result;

System.log("Script Result: " + scriptResult);

var scriptOutput = command.output;

System.log("Script Output: " + scriptOutput)

Results:

[2019-10-25 11:15:32.999] [I] executing cmd: ovftool --help

[2019-10-25 11:15:33.212] [I] Script Result: 255

[2019-10-25 11:15:33.213] [I] Script Output:

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Could you check if it works if the full path to ovftool is provided, that is, the command string to be something like

cmd = "/full/path/to/ovftool --help";

Update: I tried your code on one of my machines (vRO 7.6 + ovftool 4.2.0), and it seems to work - I got status code 0 and some text describing the usage of the tool.

Reply
0 Kudos
seangadson
Contributor
Contributor
Jump to solution

Hello,

yea I was able to get it to work turned out there was some issue with the vRO server and I was able to fix that

Reply
0 Kudos