VMware Cloud Community
MPJenkins
Contributor
Contributor
Jump to solution

Need to identify which node in a vRO cluster a workflow is executing from.

Hello everyone,

   This is my first post to the communities in a very long time, so please be gentle.  I am doing some automation work for a client, and one of the third party applications we are integrating with for password management requires that API users be tied to a specific IP address.  In a single node vRO instance this is not a problem, however this is an HA configuration, and even though it is an active/passive failover the workflows still need to work if it fails over.  About 50% of the custom flows will depend on calling a password from this third-party system.  My password calls work just fine from node 1 where I did all of the development, but now I am tackling the issue of making the flow work from either node. 

   I have a very cludgy way of circumventing this issue, using SSH to 127.0.0.1 (which defeats the point of using a password management system in the first place), but I am really hoping there is a more elegant way to accomplish this task.  Perhaps a property within vRO that can be called?  Or an action that can return the current node hostname?  If anyone has any insight, it would be greatly appreciated.

Sincerely,

Matt

1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Matt,

Unfortunately, there is no such property or action (as far as I know).

What you can try is to retrieve the hostname from vRO configurator which provides access to bound network interfaces. Here is a Javascript code snippet:

for each (var bound_ip in Config.getNetworkInterfaces().getValidBindInterfaces()) {

  var hostname = System.resolveIpAddress(bound_ip);

  if (hostname != bound_ip   // if ip and hostname are equals, this means ip cannot be resolved

    && hostname != "localhost" // ipv4 localhost

    && bound_ip != "::"  // ipv6 default unicast

    && bound_ip != "::1" // ipv6 localhost

  ) {

    // possible match; the 'hostname' variable contains the vRO node hostname

    System.log(bound_ip + "  -->  " + hostname);

  }

}

The code enumerates all valid bind interfaces, tries to resolve the hostname from each interface IP, and uses some heuristics to get rid of localhost addresses.

I don't have HA environment to test this code, but in theory it should work.

View solution in original post

2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Matt,

Unfortunately, there is no such property or action (as far as I know).

What you can try is to retrieve the hostname from vRO configurator which provides access to bound network interfaces. Here is a Javascript code snippet:

for each (var bound_ip in Config.getNetworkInterfaces().getValidBindInterfaces()) {

  var hostname = System.resolveIpAddress(bound_ip);

  if (hostname != bound_ip   // if ip and hostname are equals, this means ip cannot be resolved

    && hostname != "localhost" // ipv4 localhost

    && bound_ip != "::"  // ipv6 default unicast

    && bound_ip != "::1" // ipv6 localhost

  ) {

    // possible match; the 'hostname' variable contains the vRO node hostname

    System.log(bound_ip + "  -->  " + hostname);

  }

}

The code enumerates all valid bind interfaces, tries to resolve the hostname from each interface IP, and uses some heuristics to get rid of localhost addresses.

I don't have HA environment to test this code, but in theory it should work.

MPJenkins
Contributor
Contributor
Jump to solution

Ilian,

   Appreciate the input.  This is a nice piece of code.  I am looking at the multi-node plug-in to see if that may have a pre-made configuration item.  In the meanwhile if anyone else has another solution I would welcome more input.

Sincerely,

Matt

0 Kudos