We currently live in the world of Multi Cloud, where all the big players on the IT market have their own cloud solutions. It is no different with Oracle, which has a service called Oracle Cloud Infrastructure (OCI) in its portfolio. It is one of many IaaS platforms, i.e. Infrastructure as a Service, where we get computing power and high performance for specific applications used in the enterprise.
This article, however, was not written to endorse or deny the OCI. My goal here is to show how another big player, and more specifically VMware, with its automation solutionin Multi Cloud environments is able to cooperate with Oracle.
So to the point. At the time of writing this article, we have vRealize Automation version 8.5 available on the VMware website, so we will focus on this version. Although we already have many built-in accounts, Oracle Cloud Infrastructure is not on this list, so the fun will be so much more fun that we will be able to get to know everything from the beginning.
All work related to connecting to OCI begins with creating a free account in the Oracle service. After providing a few data thanks to which we can authenticate and verifying that we are a real person with a credit card, we can proceed to creating the first instances.
As we can see from the very beginning, we can create many elements for free, but let’s focus on virtual machines first. Creation is done by setting the name, parameters such as CPU, RAM, system image, network and generating an SSH key if we want to get to our instance using SSH. That sounds pretty reasonable. After clicking Create, we have an instance available in literally a few minutes. We were able to do the deploy quickly and efficiently without wandering through tons of documentation and studying courses. At the outset, very positive.
Let’s see what it will look like now from a different level. Due to the fact that in vRealize Automation we do not have an OCI add-on available, we need to be interested in REST API for this platform. Here, unfortunately, it is not as rosy as it was in the case of the GUI. After studying all the documentation, many videos and a few blogs, I found that REST API in OCI is not my cup of tea and I will not spend more time here than I already have.
While studying the documentation, I came across an element called oci-cli. How about configuring linux and accessing the OCI CLI from linux? Let’s see if it turned out to work. At the beginning we install any Linux distribution, in my case note the article contains product placement it will be Rocky Linux. So, after installing the utility using a freely available command
bash -c “$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)”
we have installed an element that manages the entire Oracle Cloud Infrastructure from the command line. Quickly efficient and to the point. We fly on and try to configure this tool. Here once again oracle comes to the fore and we get a simple command
oci setup config
After providing information that is required by Oracle, such as user OCID, tenancy OCID, region and key – here we have the option to generate a new one or enter the path to existing keys. We get a configured environment. Hip hip hooray, it took 15 minutes, not 4 days like in the case of REST API. We are going for good.
Let’s check if we can create an instance, i.e. we need to collect the required data, the command
and turn on the magic. Based on the documentation, we have the following
oci <service> <type> <action> <options>
compute
to <service>instance
to <type>launch
to <action>
Here, thank you for the documentation because this is what we want to test, i.e. build an instance of a virtual machine. After entering the command in the console, we get the information that we need to provide. Let’s try to find out what it is?
[root@Rocky01 .oci]# oci compute instance launch
Usage: oci compute instance launch [OPTIONS]
Error: Missing option(s) –availability-domain, –compartment-id, –shape, –subnet-id.
[root@Rocky01 .oci]#
–-compartment-id – it is nothing but the ID of our tenant, which we have already given in the configuration file, by the way, since we have a configuration file, it cannot be automatically read?
–availability-domain – the domain we need to provide for the instance? Based on this document
https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm and the manual
–availability-domain [text]
The availability domain of the instance.
Example:
Uocm: PHX-AD-1
I dare to assume that FRA-AD-1 will be an example of availability-domain for our Frankfurt
–shape – information about the resources that will be used, i.e. based on the cloud nomenclature it will be flavor. We have the command in the documentation
oci compute shape list –compartment-id
which will allow us to get to know all available resources.
–subnet-id – the last required item is the OCID for the network that will be connected. Here the documentation does not say how to find a given element, but by means of deduction, as in the case of shape list, we have a network list.
oci network subnet list –compartment-id
Well, we have all the parameters available, so let’s try to create an instance
oci compute instance launch –compartment-id ocid1.tenancy.oc1..aaaaaaaaud3p6b23qbv3loyyhryz2yxgdc6mosowoucsyfffksbgkhlqwgnq
–availability-domain “FRA-AD-1” –shape “VM.Standard.E2.1” –subnet-id ocid1.subnet.oc1.eu-frankfurt-1.aaaaaaaaom6gtx72y6dlds2mvyvzjmlx6tuxe37pc7o4ryyungzlkngwps7q
as I thought it can’t be that simple. After calling the command, we get information that we need to provide one more parameter
UsageError: Must specify –source-details or –image-id or –source-boot-volume-id
Let’s try to use -image-id here – according to the instructions, we have to present the OCID for a specific image that we will use during deployment. Of course, we can easily list all the images with the ID again with one command. Let’s add eg CentOS to our command
oci compute instance launch –compartment-id ocid1.tenancy.oc1..aaaaaaaaud3p6b23qbv3loyyhryz2yxgdc6mosowoucsyfffksbgkhlqwgnq –availability-domain “FRA-AD-1” –shape “VM.Standard.E2.1” –subnet-id ocid1.subnet.oc1.eu-frankfurt-1.aaaaaaaaom6gtx72y6dlds2mvyvzjmlx6tuxe37pc7o4ryyungzlkngwps7q –image-id ocid1.image.oc1.eu-frankfurt-1.aaaaaaaa7ioh4xpbouhntscmsg4woq6eyi33upho4izlj3rls352md4ofqmq
Another try and here we have a more interesting error
ServiceError:
{
“code”: “InvalidParameter”,
“message”: “AvailabilityDomain could not be inferred from the Request”,
“opc-request-id”: “21A514134322419B92C6DF2D07DC8994/2CD29DDF2CA4D317A45887A2CCFA4F88/22352F138DCFAC17FC6CDB45760134E9”,
“status”: 400
}
So the domain guessing failed. Fortunately, we found an article in the documentation again here along with the command
oci iam availability-domain list
Swap done
oci compute instance launch –compartment-id ocid1.tenancy.oc1..aaaaaaaaud3p6b23qbv3loyyhryz2yxgdc6mosowoucsyfffksbgkhlqwgnq –availability-domain “JzUf:EU-FRANKFURT-1-AD-1” –shape “VM.Standard.E2.1” –subnet-id ocid1.subnet.oc1.eu-frankfurt-1.aaaaaaaaom6gtx72y6dlds2mvyvzjmlx6tuxe37pc7o4ryyungzlkngwps7q –image-id ocid1.image.oc1.eu-frankfurt-1.aaaaaaaa7ioh4xpbouhntscmsg4woq6eyi33upho4izlj3rls352md4ofqmq
The command was successful and we got JSON with the result
{ "data": { "agent-config": { "are-all-plugins-disabled": false, "is-management-disabled": false, "is-monitoring-disabled": false, "plugins-config": null }, "availability-config": { "is-live-migration-preferred": null, "recovery-action": "RESTORE_INSTANCE" }, "availability-domain": "JzUf:EU-FRANKFURT-1-AD-1", "capacity-reservation-id": null, "compartment-id": "ocid1.tenancy.oc1..aaaaaaaaud3p6b23qbv3loyyhryz2yxgdc6mosowoucsyfffksbgkhlqwgnq", "dedicated-vm-host-id": null, "defined-tags": { "Oracle-Tags": { "CreatedBy": "lukasz.tworek@gmail.com", "CreatedOn": "2021-08-20T09:35:12.546Z" } }, "display-name": "instance20210820093512", "extended-metadata": {}, "fault-domain": "FAULT-DOMAIN-1", "freeform-tags": {}, "id": "ocid1.instance.oc1.eu-frankfurt-1.antheljttw5wjlicscduyvvzkw3raljnjpsv3acn2wqxetpixvehw4tlbbaq", "image-id": "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaa7ioh4xpbouhntscmsg4woq6eyi33upho4izlj3rls352md4ofqmq", "instance-options": { "are-legacy-imds-endpoints-disabled": false }, "ipxe-script": null, "launch-mode": "PARAVIRTUALIZED", "launch-options": { "boot-volume-type": "PARAVIRTUALIZED", "firmware": "UEFI_64", "is-consistent-volume-naming-enabled": true, "is-pv-encryption-in-transit-enabled": false, "network-type": "PARAVIRTUALIZED", "remote-data-volume-type": "PARAVIRTUALIZED" }, "lifecycle-state": "PROVISIONING", "metadata": {}, "platform-config": null, "preemptible-instance-config": null, "region": "eu-frankfurt-1", "shape": "VM.Standard.E2.1", "shape-config": { "baseline-ocpu-utilization": null, "gpu-description": null, "gpus": 0, "local-disk-description": null, "local-disks": 0, "local-disks-total-size-in-gbs": null, "max-vnic-attachments": 2, "memory-in-gbs": 8.0, "networking-bandwidth-in-gbps": 0.7, "ocpus": 1.0, "processor-description": "2.0 GHz AMD EPYC\u2122 7551 (Naples)" }, "source-details": { "boot-volume-size-in-gbs": null, "image-id": "ocid1.image.oc1.eu-frankfurt-1.aaaaaaaa7ioh4xpbouhntscmsg4woq6eyi33upho4izlj3rls352md4ofqmq", "kms-key-id": null, "source-type": "image" }, "system-tags": {}, "time-created": "2021-08-20T09:35:12.948000+00:00", "time-maintenance-reboot-due": null }, "etag": "3653b1957ce392c0f28070b5948e6e180160d6d8c5d35340f7235d1dc0bd2cd4", "opc-work-request-id": "ocid1.coreservicesworkrequest.oc1.eu-frankfurt-1.abtheljtvmigspuy7f3bj4ovkxugtskyvctjjxalh46jw3gvchqfcyj7w5za" }
Well, we have success. Our instance is working
Now that we can create an instance, let’s create a connection with vRealize Automation
vRealize Automation comes with a set of ready-made solutions, eg calling the command after SSH on linux. In the presented case, we call a simple df -h command and get its result on the console
If we have a simple workflow and our tested command, theoretically we have everything to create an automatic workflow for creating a VM. Let’s try.
After calling the runes, the command is called
and we at OCI have another instance.
It looks promising the more that each of the OCI commands returns JSON which, after parsing, will allow us to create a workflow that will automatically download customer data from OCI
and create drop-down lists with available parameters. In my opinion, Oracle Cloud Infrastructure, if it improves some documentation and solutions with REST API, will be a useful solution that we can easily call from vRealize Automatio and thus we will have another endpoint available in a multi-cloud environment. vRealize Automation will become the only console that we will use on a daily basis as end users, and we will only exhibit this console for business.
There is still some work ahead of me to beautify it, but I hope that I encouraged you to get to know both products and experiment with these solutions.