SSH command with YAML

Table of Contents

SSH command [Password]

YAML parameters for SSH command [Password]

NameTypeDescription
action
Required
StringThe ID of the action.
type
Required
StringThe type of the action. Should be set to SSH_COMMAND.
authentication_mode
Required
StringThe authentication mode for SSH. Should be set to PASS.
commands
Required
String[]The array of commands invoked on the remote server.
host
Required
StringThe host for the connection.
login
Required
StringThe username required to connect to the server.
password
Required
StringThe password required to connect to the server.
port
Required
StringThe port for the connection.
run_as_scriptBooleanIf set to true, commands are executed as a regular script. If set to false, the commands will be executed one by one, in non-interactive mode.
shellStringThe name of the shell that will be used to execute commands. Can be one of SH (default) or BASH.
working_directoryStringThe absolute or relative path on the remote server.
execute_every_commandBooleanIf set to true all commands will be executed regardless of the result of the previous command.

YAML example for SSH command [Password]

actions:
- action: "[12.34.56.78] Execute: npm install --silent"
  type: "SSH_COMMAND"
  working_directory: "/"
  login: "api_tests_user"
  password: "$api_tests_password"
  host: "12.34.56.78"
  port: "22"
  authentication_mode: "PASS"
  ignore_errors: true
  shell: "SH"
  run_as_script: true
  commands:
  - "npm prune"
  - "npm install --silent"
  variables:
  - key: "api_tests_password"
    value: "secure!14ivLMxPgv7TX6c9+ITX/g=="
    encrypted: true

SSH command [Private key from environment variables]

YAML parameters for SSH command [Private key from environment variables]

NameTypeDescription
name
Required
StringThe name of the action.
type
Required
StringThe type of the action. Should be set to SSH_COMMAND.
authentication_mode
Required
StringThe authentication mode for SSH. Should be set to ENV_KEY.
commands
Required
String[]The array of commands invoked on the remote server.
host
Required
StringThe host for the connection.
login
Required
StringThe username required to connect to the server.
password
Required
StringThe password required to connect to the server.
port
Required
StringThe port for the connection.
env_key
Required
StringThe private SSH key name defined in environment variables.
passphraseStringThe passphrase for the private SSH key.
run_as_scriptBooleanIf set to true, commands are executed as a regular script. If set to false, the commands will be executed one by one, in non-interactive mode.
shellStringThe name of the shell that will be used to execute commands. Can be one of SH (default) or BASH.
working_directoryStringThe absolute or relative path on the remote server.
execute_every_commandBooleanIf set to true all commands will be executed regardless of the result of the previous command.

YAML example for SSH command [Private key from environment variables]

actions:
- action: "[12.34.56.78] Execute: npm install --silent"
  type: "SSH_COMMAND"
  working_directory: "/"
  login: "$api_tests_user"
  host: "12.34.56.78"
  port: "22"
  env_key: "MyKey"
  authentication_mode: "ENV_KEY"
  ignore_errors: true
  shell: "SH"
  run_as_script: true
  commands:
  - "npm prune"
  - "npm install --silent"
    variables:
  - key: "api_tests_user"
    value: "userLogin123"

SSH command [Private Key & Password]

YAML parameters for SSH command [Private Key & Password]

NameTypeDescription
action
Required
StringThe ID of the action.
type
Required
StringThe type of the action. Should be set to SSH_COMMAND.
authentication_mode
Required
StringThe authentication mode for SSH. Should be set to PRIVATE_KEY_AND_PASS.
commands
Required
String[]The array of commands invoked on the remote server.
host
Required
StringThe host for the connection.
login
Required
StringThe username required to connect to the server.
password
Required
StringThe password required to connect to the server.
port
Required
StringThe port for the connection.
server_key
Required
StringThe private SSH key.
passphraseStringThe passphrase for the private SSH key.
run_as_scriptBooleanIf set to true, commands are executed as a regular script. If set to false, the commands will be executed one by one, in non-interactive mode.
shellStringThe name of the shell that will be used to execute commands. Can be one of SH (default) or BASH.
working_directoryStringThe absolute or relative path on the remote server.
execute_every_commandBooleanIf set to true all commands will be executed regardless of the result of the previous command.

YAML example for SSH command [Private Key & Password]

actions:
- action: "[12.34.56.78] Execute: npm install --silent"
  type: "SSH_COMMAND"
  working_directory: "/"
  login: "$api_tests_user"
  password: "$api_tests_password"
  host: "localhost"
  port: "22"
  server_key: "-----BEGIN RSA PRIVATE KEY-----\r\nProc-Type: 4,ENCRYPTED\r\nDEK-Info: DES-EDE3-CBC,688DBB59CFC83D58\r\n\r\n1m3qZGEqXEfLPIm9KZacr17/iMVOIJcvSLoMJueM8+QbcK4JStzbre2AN99TkCN/\r\nr1V12deiq/lJUPX07K30tnsTS+7z4Pq/D2WhirD+WQcREgdQU1A8dlx2NMRDi7d0\r\n32w8ZPlciz3bc5rpF0vy5Ll2q9TWye4fpgQwPUnEkam0SaRRw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7rEmBAdLfNyA7xyqH2JLtlflaH9QApl7vE\r\nGNJJ5iuHCHPJwfhlaSMBF/Cb9Ofp4BM5fnNKrwaI9twv//U6XhVfYRcaKhCFEoMb\r\nYo4k7cKTQzL95xT1aYnwqSqtaDfoXASoA9j/mD0aMU+9zQEa0tVbJ/6Zjn3vMSTx\r\npvCYkXy9kZzEJZ2r7BiaQX0HX5Ki/Opt4eTWL5NbokDsE1bQu+D2BskJz30pRRRK\r\nvRargCRNl26158HNRLPkbo/gkwfJbfIBFgJ8YEQkcNap110oEaW6l3lnktZ0Ct3P\r\nEjkrppoV6UU1HCVmcoljOldTXQZuKmpz7aIuSwmUqoU4vWNvYteIZ3BhaVwCu/p8\r\nVaFL8Sapda0WYXPWXHuV+Dj295bedJxeqraWrQB87vKP4NVyzWv1WA==\r\n-----END RSA PRIVATE KEY-----\r\n"
  passphrase: "api_tests_passphrase"
  authentication_mode: "PRIVATE_KEY_AND_PASS"
  ignore_errors: true
  shell: "SH"
  run_as_script: true
  commands:
  - "npm prune"
  - "npm install --silent"
  variables:
  - key: "api_tests_user"
    value: "userLogin123"
  - key: "api_tests_password"
    value: "secure!14ivLMxPgv7TX6c9+ITX/g=="
    encrypted: true

Proxy

To define a proxy server, use the following parameters:

NameTypeDescription
proxy_loginStringThe username required to connect to the proxy server.
proxy_hostStringThe host for the proxy connection.
proxy_portStringThe port for the proxy connection.
proxy_authentication_modeStringThe authentication mode for SSH proxy connection. Can be set to PASS, PRIVATE_KEY, PRIVATE_KEY_AND_PASS or ENV_KEY.
proxy_passwordStringThe password required to connect to the proxy server.
proxy_passphraseStringThe passphrase for the private SSH key.
proxy_env_keyStringThe private SSH key name defined in environment variables.
proxy_server_keyStringThe private SSH key.

Example for Proxy Password

  proxy_authentication_mode: "PASS"
  proxy_login: "proxyUser"
  proxy_host: "proxyHost"
  proxy_port: "proxyPort"
  proxy_password: "secure!k/jFegNf7aQx45852g39dg==.N3PyCtKkDwTnpVvXp5RHbw=="

Example for Proxy Private Key

  proxy_authentication_mode: "PRIVATE_KEY"
  proxy_login: "proxyUser"
  proxy_host: "proxyHost"
  proxy_port: "proxyPort"
  proxy_passphrase: "secure!k/jFegNf7aQx45852g39dg==.N3PyCtKkDwTnpVvXp5RHbw=="
  proxy_server_key: "secure!k/jFegNf7aQx45852g39dg==.N3PyCtKkDwTnpVvXp5RHbw=="

Example for Proxy Private Key and Password

  proxy_authentication_mode: "PRIVATE_KEY_AND_PASS"    
  proxy_login: "proxyUser"
  proxy_host: "proxyHost"
  proxy_port: "proxyPort"
  proxy_password: "secure!k/jFegNf7aQx45852g39dg==.N3PyCtKkDwTnpVvXp5RHbw=="
  proxy_passphrase: "secure!k/jFegNf7aQx45852g39dg==.N3PyCtKkDwTnpVvXp5RHbw=="
  proxy_server_key: "secure!k/jFegNf7aQx45852g39dg==.N3PyCtKkDwTnpVvXp5RHbw=="

Example for Proxy Env Key

  proxy_authentication_mode: "ENV_KEY"
  proxy_login: "proxyUser"
  proxy_host: "proxyHost"
  proxy_port: "proxyPort"
  proxy_env_key: "secure!ioUb9m6kYw1HgYw9Bg5Yqw==.lstPCaFyljrGmSbpb6M6VQ=="

Last modified on April 26, 2022

Questions?

Not sure how to configure a pipeline for your process? Reach out on the live-chat or contact support

Get Started

Sign up for free and deploy your project in less than 10 minutes.