ManageIQ integration with vRO


#1

Hello Community.

Has anyone integrated ManageIQ with VMWare vRO as a provider ?

Thanks In Advance


#2

@James_Buckett

I’m just working on that (we already have quite complex deployment script prepared in vRO and don’t want to re-write everything from the scratch).

You can easily run Orchestrator workflow via REST API from ManageIQ method (using rest-client).
You can easily access ManageIQ via REST API from the Orchestrator workflow.

Feel free to ask or/and share any interesting findings or tips regarding this topic. :wink:


#3

@maaca

Could you please provide examples of the REST calls please.
.
Both vRO to ManageIQ and ManageIQ to vRO please.

Thank You In Advance.


#4

@James_Buckett

The code is not too elegent, but hopefully will help you to begin somewhere.

Run vRO workflow with one variable and wait for result:

require 'rest-client'
require 'json'

username = $evm.object['username']
password = $evm.object.decrypt('password')
wfid = $evm.object['wfid']
variable = $evm.object['variable']
vro = $evm.object['vro']

xmlstring = '<execution-context xmlns="http://www.vmware.com/vco"> <parameters> <parameter name="input" type="string"> <string>' + variable + '</string> </parameter> </parameters> </execution-context>'

url = 'https://' + vro + ':8281/vco/api'
query = '/workflows/' + wfid + '/executions/'
rest_return = RestClient::Request.execute(
                                method: :post,
                                url: url + query,
                                :user => username,
                                :password => password,
                                :payload => xmlstring,
                                :headers => {:content_type => 'application/xml'},
                                verify_ssl: false)

url2 = rest_return.headers[:location]

state = 'running'
while (state == 'running')
  rest_return2 = RestClient::Request.execute(
                                method: :get,
                                url: url2,
                                :user => username,
                                :password => password,
                                verify_ssl: false)
  state = JSON.parse(rest_return2)['state']
end

result = JSON.parse(rest_return2)['output-parameters'][0]['value']['string']['value']

To access ManageIQ, use “Invoke a dynamic REST operation” wf with baseUrl http://…/api, proper apiMethod, user, password, queryString, …