Skip to content

Instantly share code, notes, and snippets.

Avatar

Yağmur Özden YagmurOzden

View GitHub Profile
@YagmurOzden
YagmurOzden / validateVM.js
Last active Sep 8, 2022
Select virtual machine by its name (also, this action checks whether VM tools are installed, if VM is powered on, etc.)
View validateVM.js
// VMware vRealize Orchestrator action sample
// vRA 8.8.0
//input type : hostname [string]
//return type: VC:VirtualMachine
var vmSearch = VcPlugin.getAllVirtualMachines(null, hostname);
if (vmSearch.length > 1) {
for each (var vmObj in vmSearch) {
if (vmObj.summary.guest) {
System.log("Matched ## " + vmObj.summary.guest.hostName);
@YagmurOzden
YagmurOzden / getConfigurationElements.js
Created Aug 29, 2022
Returns the configuration element
View getConfigurationElements.js
// VMware vRealize Orchestrator action sample
// vRA 8.7.0
// input types: categoryPath [string]
configName [string]
// return type: ConfigurationElement
var category = Server.getConfigurationElementCategoryWithPath(categoryPath);
for each (var c in category.configurationElements){
if (c.name == configName){
return c;
@YagmurOzden
YagmurOzden / RestTemplate.js
Created Aug 29, 2022
Rest Template for using rest operations.
View RestTemplate.js
// VMware vRealize Orchestrator action sample
// vRA 8.7.0
// input type: restHost [REST:RESTHost]
// return type: Any
function createRestOperation(method, urlTemplate) {
var op = new RESTOperation(urlTemplate);
op.name = urlTemplate;
op.method = method;
@YagmurOzden
YagmurOzden / ApplyCustomSpec.js
Created Aug 3, 2022
it creates a Custom Specification for reconfigure the VM. and this custom spec creates 2 nic one of them with static connection and the other nic is eth1 and it uses DHCP
View ApplyCustomSpec.js
// VMware vRealize Orchestrator action sample
// vRA 8.8.0
//It creates 2 nic one of them with static connection and the other nic is eth1 and it uses DHCP
//so therefore i am connecting the machine after this action has deployed and change its value inside.
//action input type: VM vc:virtual machine
guestNetInfoDNSServerList Array string
guestNetInfoDNSSuffixList Array string
guestNetInfoDomain string
@YagmurOzden
YagmurOzden / PowerOFFVM.js
Created Jul 29, 2022
Powering off the VM with vim3WaitTaskEnd. VMware vRealize Orchestrator vRO 8.5.0, JavaScprit
View PowerOFFVM.js
// VMware vRealize Orchestrator action sample
// vRA 8.5.0
//action input type: vm : VC:VirtualMachine
//action return type: void
var poweroffTask = vm.powerOffVM_Task();
System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(
@YagmurOzden
YagmurOzden / PowerONVM.js
Created Jul 29, 2022
Powering on the VM with vim3WaitTaskEnd. VMware vRealize Orchestrator vRO 8.5.0, JavaScprit
View PowerONVM.js
// VMware vRealize Orchestrator action sample
// vRA 8.5.0
//action input type: vm : VC:VirtualMachine
//action return type: void
var poweronTask = vm.powerOnVM_Task();
System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(
@YagmurOzden
YagmurOzden / getClustersHost.js
Created Apr 5, 2022
returns a random host belonging to that cluster , vRO, vRO action, workflow, cluster, host
View getClustersHost.js
// VMware vRealize Orchestrator action sample
// vRA 8.4
//workflow return type: (VC:HostSystem),
// input type: cluster(string, Enter the cluster entry so that the host can be selected)
// this code below gets all clusters
var clusters =VcPlugin.getAllClusterComputeResources();
var hosts = VcPlugin.getAllHostSystems();
@YagmurOzden
YagmurOzden / mailContent.js
Created Jan 6, 2022
content of the mail about catalog item informations. | VMware vRO workflow, vSphere, GuestOS, VM, Virtual Machine, vRO action, mail content with html css
View mailContent.js
// VMware vRealize Orchestrator action sample
// vRA 8.4
//workflow input type: time (number),
// date (string)
//workflow return type: string
@YagmurOzden
YagmurOzden / numberOfRepetitionsAsProp.js
Created Jan 6, 2022
This action creates properties about which catalogue item used how many times. | VMware vRO action, vSphere, Configuration Element
View numberOfRepetitionsAsProp.js
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: none
//action return type: Properties
var deployment = System.getModule("<your-path-name>").getConfigurationElementWhoseTypeIsProperties("Catalog Item Credentials","deployment");
var catalogItems =System.getModule("<your-path-name>").getConfigurationElementWhoseTypeIsProperties("Catalog Item Credentials","catalogItems");
@YagmurOzden
YagmurOzden / getVMsCluster.js
Created Jan 6, 2022
VMware vRO action, vSphere, Virtual Machine, get virtual machine's cluster
View getVMsCluster.js
// VMware vRealize Orchestrator action sample
// vRA 8.4
//action input type: vm (VC:VirtualMachine)
//action return type: VC:ClusterComputeResource
var parent = vm.runtime.host;
while (parent !== null && ! (parent instanceof VcClusterComputeResource)) {