The previous article describes the implementation of the basic interaction between vRealize Orchestrator and Yandex.Cloud. The new version of the package is aimed at managing Yandex instances from vRA through Dymamic Types objects. The necessary processes have been developed, a set of objects for vRA has been created: resources, actions, blueprints.
When I first got to know the Yandex.Cloud API, I had a lot of questions about documentation and support. The result of our communication with support was the revised documentation on the transfer of metadata when creating instances.
All processes of the first version of the package described in the article vRO: integration with Yandex.Cloud have been improved and included in the new version of the package.
VRA integration pack – Yandex.Cloud
v1.5.0
Dymamic Types
Working with Yandex instances in vRA is implemented through the DymamicTypes object: Yandex.Instance. Its work is provided by a set of processes standard for DymamicTypes:
- Find all Yandex objects – returns all objects of the specified type;
- “Find relation Yandex objects” – for a given object, returns all its child objects by the name of the link;
- “Find Yandex object by ID” – returns an object by its type and ID;
- Has Yandex object children – determines whether the object has child objects.

Checking Execution Status
Any task launched in the cloud does not happen instantly. After sending an API request to perform any actions with instances, instead of the result, you will receive an object of the launched operation:
{ "done": false, "metadata": { "@type": "type.googleapis.com/yandex.cloud.compute.v1.CreateInstanceMetadata", "instanceId": "fhmpm25jr3r4li0ud70g" }, "id": "fhmpbea994ufleduq322", "description": "Create instance", "createdAt": "2019-12-05T05:57:32Z", "createdBy": "aje6*********thio", "modifiedAt": "2019-12-05T05:57:32Z" }
The done field contains the current status of the operation: false – the operation is still in progress, true – the operation is completed. If the operation is completed, then additionally one of the error or response fields will be returned . The error object contains the code , message, and details fields that describe the error. The response object will contain the target resource for the operation, if any. For example, for the above operation description, it will be an instance object (see also https://cloud.yandex.ru/docs/api-design-guide/concepts/operation ).
To track the result of the operations, it was required to create another REST host Yandex_Operation in vRO and a new operation: getOperation. There are also two processes developed:
- “Get operation” – getting the status of an operation by its ID;
- “Wait operation” – waiting for the execution of the specified operation. The process in a loop every delay seconds receives the status of the operation and analyzes the response. If the operation is successful, then a response object is returned ; otherwise, an error is generated.
Additional processes
Processes for vRA XaaS Blueprints and instance actions:
- “Create instance” – a request to create a new instance and wait for the request to be completed. Returns a DymamicTypes object: Yandex.Instance;
- “Day2 operation” – calls the required action for the instance and waits for its execution. Different actions on an instance from the vRA interface call this process with different input parameters;
- “Register instance” – by instance ID, returns the DymamicTypes: Yandex.Instance object for publication on the vRA portal;
- “Unregister instance” – does nothing, if you need to do something when deleting an object from the vRA portal, then write in this process, for example, deleting DNS records.

Preparing the package for work
1. Installing the package in vRealize Orchestrator:
- ATTENTION! You DO NOT need to import the ru.zabedu.yandex.package package from the ‘vRA-Yandex.Cloud-Integration.zip’ archive via the Packages tab. The package contains DynamicTypes settings that will not be applied on import;
- Go to the ‘Workflows’ tab, Library-> the Dynamic Types-> the Configuration , start the process of «Import Configuration From Package» and in the Select file ‘ru.zabedu.yandex.package’;
- Check that all items have been successfully imported: processes, actions, config items, new DynamicTypes.
2. Preparing the process for obtaining a JWT key:
- Create a service account on Yandex.Cloud and an authorized key (see vRO: integration with Yandex.Cloud );
- Place the get-yandex-jwt-token.py script and the private part of the authorized key on a server with SSH access (the script requires the python PyJWT and cryptography modules);
- Specify in this script the service account ID ( service_account_id ), the used key ID ( key_id ) and the path to the private key;
- Add the script path on the SSH server to the yandexCloud configuration element in the getJwtTokenScriptPath attribute;
- In the “Get JWT token” process, replace the “Run SSH command (vrassh)” process with your own SSH command execution process and configure its parameters;
- Check that the process is working, it should return a JWT key.
3. Start the Initialize process, which does:
- Saving the ID of the working directory and ID of the service account in the yandexCloud configuration item ;
- Launches the process of registering REST hosts (5 pcs) and saves links to them in the configuration item: “Add Yandex REST hosts” process;
- Launches the registration process on the hosts of REST operations: “Add Yandex REST operations”;
- Launches the process of obtaining and saving a new IAM token: “Get new IAM token”;
- Creates a schedule for updating the IAM token.
4. Import the package into vRealize Automation:
- Connect to vRA from vRealize CloudClient: $ vra login userpass – user user @ zabedu . ru – tenant zabedu – server https : //vra.zabedu.ru
- Import the package into vRA: $ vra content import – path / home / as / vRA – Yandex . zip – resolution OVERWRITE – verbose
- Configure access to blueprints, allow actions with them “Start”, “Stop”, “Restart”, “Delete” and “Unregister”.
Files for the article
vRA-Yandex.Cloud-Integration.zip – integration package.
Translated by Google Translate