SSH@0 - SSH v0 タスク

このタスクを使用して、SSH を使用してリモート コンピューターでシェル コマンドまたはスクリプトを実行します。 このタスクを使用すると、SSH を使用してリモート コンピューターに接続し、コマンドまたはスクリプトを実行できます。

構文

# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
  inputs:
    sshEndpoint: # string. Required. SSH service connection. 
    runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required. Run. Default: commands.
    commands: # string. Required when runOptions = commands. Commands. 
    #scriptPath: # string. Required when runOptions = script. Shell script path. 
    #inline: # string. Required when runOptions = inline. Inline Script. 
    #interpreterCommand: '/bin/bash' # string. Optional. Use when runOptions = inline. Interpreter command. Default: /bin/bash.
    #args: # string. Optional. Use when runOptions = script. Arguments. 
  # Advanced
    #failOnStdErr: true # boolean. Fail on STDERR. Default: true.
    #interactiveSession: false # boolean. Enable interactive session. Default: false.
    readyTimeout: '20000' # string. Required. SSH handshake timeout. Default: 20000.
    #interactiveKeyboardAuthentication: false # boolean. Use interactive-keyboard authentication. Default: false.
# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
  inputs:
    sshEndpoint: # string. Required. SSH service connection. 
    runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required. Run. Default: commands.
    commands: # string. Required when runOptions = commands. Commands. 
    #scriptPath: # string. Required when runOptions = script. Shell script path. 
    #inline: # string. Required when runOptions = inline. Inline Script. 
    #interpreterCommand: '/bin/bash' # string. Optional. Use when runOptions = inline. Interpreter command. Default: /bin/bash.
    #args: # string. Optional. Use when runOptions = script. Arguments. 
  # Advanced
    #failOnStdErr: true # boolean. Fail on STDERR. Default: true.
    #interactiveSession: false # boolean. Enable interactive session. Default: false.
    readyTimeout: '20000' # string. Required. SSH handshake timeout. Default: 20000.
# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
  inputs:
    sshEndpoint: # string. Required. SSH service connection. 
    runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required. Run. Default: commands.
    commands: # string. Required when runOptions = commands. Commands. 
    #scriptPath: # string. Required when runOptions = script. Shell script path. 
    #inline: # string. Required when runOptions = inline. Inline Script. 
    #args: # string. Optional. Use when runOptions = script. Arguments. 
  # Advanced
    #failOnStdErr: true # boolean. Fail on STDERR. Default: true.
    readyTimeout: '20000' # string. Required. SSH handshake timeout. Default: 20000.
# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
  inputs:
    sshEndpoint: # string. Required. SSH service connection. 
    runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required. Run. Default: commands.
    commands: # string. Required when runOptions = commands. Commands. 
    #scriptPath: # string. Required when runOptions = script. Shell script path. 
    #inline: # string. Required when runOptions = inline. Inline Script. 
    #args: # string. Optional. Use when runOptions = script. Arguments. 
  # Advanced
    #failOnStdErr: true # boolean. Fail on STDERR. Default: true.

入力

sshEndpoint - SSH サービス接続
string. 必須です。

リモート コンピューターの接続の詳細を含む SSH サービス接続の名前を指定します。 SSH サービス接続を作成するには、リモート コンピューターのホスト名または IP アドレス、ポート番号、およびユーザー名が必要です。

  • 認証には秘密キーとパスフレーズを指定する必要があります。
  • パスワードを使用してリモート Linux マシンに対する認証を行うことができますが、これは macOS または Windows システムではサポートされていません。

runOptions - 実行
string. 必須です。 使用できる値: commandsscript (スクリプト ファイル)、 inline (インライン スクリプト)。 既定値: commands

リモート コンピューターでシェル コマンドまたはシェル スクリプトを実行します。


commands - コマンド
string. runOptions = commands の場合に必要です。

リモート コンピューターで実行するシェル コマンドを指定します。 このパラメーターは、[実行] オプションに [コマンド] が選択されている場合にのみ使用できます。 複数行テキスト ボックスの新しい行に各コマンドを引数と共に入力します。 複数のコマンドを一緒に実行するには、セミコロンで区切って同じ行にコマンドを入力します。 例: cd /home/user/myFolder;build.

Note

各コマンドは、個別のプロセスで実行されます。 相互に依存する一連のコマンドを実行する場合 (たとえば、コマンドを実行する前に現在のフォルダーを変更する場合)、代わりに インライン スクリプト オプションを使用します。


scriptPath - シェル スクリプトパス
string. runOptions = script の場合に必要です。

リモート コンピューターで実行するシェル スクリプト ファイルへのパスを指定します。 このパラメーターは、[実行] オプションで [シェル スクリプト] が選択されている場合にのみ使用できます。


inline - インライン スクリプト
string. runOptions = inline の場合に必要です。

リモート コンピューターで実行するシェル スクリプトを書き込みます。


interpreterCommand - インタープリター コマンド
string. 省略可能。 の場合は runOptions = inlineを使用します。 既定値: /bin/bash

スクリプトの実行に使用するコマンド インタープリターへのパスを指定します。 スクリプトの先頭に shebang 行を追加します。 UNIX に似たオペレーティング システムにのみ関連します。 Windows ベースのリモート ホストには空の文字列を使用します。 shebang (#!) の詳細を確認してください。


args - 引数
string. 省略可能。 の場合は runOptions = scriptを使用します。

シェル スクリプトに渡す引数を指定します。 このパラメーターは、[実行] オプションで [シェル スクリプト] が選択されている場合にのみ使用できます。


failOnStdErr - STDERR で失敗する
boolean. 既定値: true

値が の場合、 trueリモート コマンドまたはスクリプトが に STDERR書き込まれると、ビルドは失敗します。


interactiveSession - 対話型セッションを有効にする
boolean. 既定値: false

対話型セッションを開始します。 パスワード要求は、ユーザーのパスワードによって入力されます。 対話型セッションは、 などの sudoコマンドを実行する場合に役立ちます。


readyTimeout - SSH ハンドシェイクのタイムアウト
string. 必須です。 既定値: 20000

タスクが SSH ハンドシェイクの完了を待機する時間 (ミリ秒単位) を指定します。


interactiveKeyboardAuthentication - 対話型キーボード認証を使用する
boolean. 既定値: false

対話型キーボード認証を有効にします。 宛先 SSH サーバーで対話型キーボード認証が必要な場合は に true 設定します (PasswordAuthentication ターゲット コンピューターでは無効になっているか、sshd_configでは [いいえ] に設定されます)。


タスク制御オプション

すべてのタスクには、タスク入力に加えて制御オプションがあります。 詳細については、「 コントロール オプションと一般的なタスク プロパティ」を参照してください。

出力変数

[なし] :

解説

このタスクを使用して、SSH を使用してリモート コンピューターでシェル コマンドまたはスクリプトを実行します。 このタスクを使用すると、SSH を使用してリモート コンピューターに接続し、コマンドまたはスクリプトを実行できます。

前提条件

  • タスクで、SSH キー ペアを使用したリモート マシンへの接続がサポートされている。
  • 公開キーを、事前にインストールするか、リモート マシンにコピーする必要がある。

サポートされているアルゴリズム

キー ペア アルゴリズム

  • RSA
  • DSA

暗号化アルゴリズム

  • aes256-cbc
  • aes192-cbc
  • aes128-cbc
  • blowfish-cbc
  • 3des-cbc
  • arcfour256
  • arcfour128
  • cast128-cbc
  • arcfour

OpenSSL v1.0.1 以降 (エージェント上):

  • aes256-ctr
  • aes192-ctr
  • aes128-ctr

OpenSSL v1.0.1 以降の場合、NodeJS v0.11.12 以降 (エージェント上):

  • aes128-gcm
  • aes128-gcm@openssh.com
  • aes256-gcm
  • aes256-gcm@openssh.com

要件

要件 説明
パイプラインの種類 YAML、クラシック ビルド、クラシック リリース
実行日 エージェント、DeploymentGroup
確認要求 なし
Capabilities このタスクは、ジョブ内の後続のタスクに対する要求を満たしていません。
コマンドの制限 Any
設定可能な変数 Any
エージェントのバージョン 2.144.0 以上
タスクのカテゴリ デプロイ
要件 説明
パイプラインの種類 YAML、クラシック ビルド、クラシック リリース
実行日 エージェント、DeploymentGroup
確認要求 なし
Capabilities このタスクは、ジョブ内の後続のタスクに対する要求を満たしていません。
コマンドの制限 Any
設定可能な変数 Any
エージェントのバージョン 2.102.0 以上
タスクのカテゴリ デプロイ

関連項目