Quick To The Point – No port options on vCO ssh plug-in.
Do you run ssh on its standard and default port? I for one, do not. That's why I was surprised when I found that the built in workflows for the ssh plugin in vCO have no input parameter for port and simply ride along the standard ssh port of 22
Thankfully for those of us that modify our sshd_config the underlying methods and constructs of the ssh plugin allow for us to specify a port, it's just the workflows built around them don't reflect that. So lets go through an example of modifying the "Run SSH Command" workflow to accept a port.
First up, duplicate the workflow. You don't want to modify the original as you have no idea what might be using it.
Next, we need to add an input parameter (type string) called, you guessed it. – port.
On the Presentation tab let's drag our port parameter up to the Host selection display group so things look nice and pretty
Now let’s edit the first scriptable task in the schema (Execute SSH Command). We will need to ensure that we have access to our port parameter by mapping it in our ‘In’ tab.
And on the Scripting tab of that same element, we can see our session gets established on Line 2. Here we can simply change the options we send to that construct from “var session = new SSHSession(hostName,username);” to “var session = new SSHSession(hostName,username,port);”
Save and close your workflow. Go ahead and test it now. You should now be executing your ssh commands on whichever port you have specified. Now you can go ahead and add a port parameter to any workflow that references new SSHSession();