In Stambia, SSH Metadatas can be created to manipulate SSH, SCP and SFTP protocols.
They can be used in processes with actions like Execute SSH , Send Files with SCP or Get Files with SCP.
We are going to see in this article how to configure such a metadata, and how to use it in basic processes.
Creating and configuring an SSH Metadata
The SSH Metadata can be found in metadata creation window, and is named SSH Server.
The configuration is located on the node of the metadata.
- Private Key File parameter is the path to the private ssh key
- Password phrase parameter is the passphrase of the ssh key, if there is one
- Additional Connection Properties parameter allows to define additional connection properties in the form of Java Properties. (key=value lines separated with line returns)
Next, we can add folders to this metadata with
Right click > new > remote directory. These folders can be used in processes to fill automatically action parameters.
Using the Metadata in a Process
SSH process actions can be easily used with the metadata. All the connections settings are filled automatically when the metadata nodes are dragged and dropped on them.
It is possible to use directly a folder, like on SCP action for example. The SCP_REMOTE_DIR will be filled too.
It is a better practice to use metadatas instead of defining all the parameters on each actions. It permits to simplify a lot the maintenance, debug, and update of your work, but also to apply Configurations to use and test different settings very easily.
For more informations about configurations, you can read
Working with Configurations in the Stambia Designer Help Content.
Execute SSH Action
The first action in the process is used to send ssh commands to the server. They are put in the body of the action :
The Execute SSH action opens a non-interactive shell session on the remote server.
- Keep in mind that this kind of session does not load the user's environement and profile scripts
- See your shell's documentation for more information (documentation for bash)
- An easy way to load environment variables is to "source /home/user/some_config.sh" as the first line of the Action Code
Send files with SCP Action
The second action is used to send files with SCP.
The SCP remote dir is the directory in which files will be sent.
The SCP Local File is path to the file you want to send.
See the Designer's Help for more information about each parameters.