接続のテスト

WebSphere Automation および WebSphere Application Server または WebSphere Application Server Liberty サーバー間のリモート・アクセスを検証します。

開始前に

このタスクでは、WebSphere Automation クラスターへの管理アクセス権限が必要です。

手順

  1. runcli testConnection コマンドを実行します。 runcli testConnection コマンドは、 runbook-manager ポッドのコンソールから実行できます。
    MANAGER_POD=$(oc get pod -l app.kubernetes.io/component=runbook-manager -o name | head -n 1)
    oc rsh $MANAGER_POD runcli testConnection <hostname> [operatingSystem]

    管理対象サーバーのホスト名をパラメーターとして渡すか、オペレーティング・システム名をパラメーターとして渡してください。 以下の例を参照してください。

    oc rsh $MANAGER_POD runcli testConnection myvm linux

    構成済みの SSH パラメーターまたは WinRM パラメーターを使用して、管理対象サーバーへの接続を試行するジョブが開始されます。 以下の出力例を参照してください。

    2021 年 10 月 22 日 6:47:23 PM com.ibm.ws.automation.core.runbook.manager.RunbookManagerCLI clientMode
    INFO: 開始中
    作成されたジョブ: test-connection-1634928445267
    oc logs --tail=100 -l job-name=test-connection-1634928445267 を実行します
  2. ジョブ・ログで接続の問題がないか調べてください。
    成功した接続の出力:
    [11/02/21 19:05:36:746 UTC] 1    com.ibm.ws.automation.core.runbook.runner.RunbookRunnerCLI INFO appMode Runbook Runner Starting
    [11/02/21 19:05:38:952 UTC] 1    com.ibm.ws.automation.core.runbook.runner.RunbookRunnerCLI INFO start Request received to execute runbook: test-connection against server: test-server.example.com (correlationId: 1635879932990)
    [11/02/21 19:05:39:033 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook Here is the standard output of the command:
    
    [11/02/21 19:05:39:129 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook was:
    [11/02/21 19:05:39:129 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook   hosts:
    [11/02/21 19:05:39:129 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook     test-server.example.com:
    [11/02/21 19:05:39:130 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook       ansible_connection: ssh
    [11/02/21 19:05:39:130 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook       ansible_shell_type: powershell
    [11/02/21 19:05:39:130 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook       ansible_user: Administrator
    [11/02/21 19:05:39:133 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook Agent pid 48
    [11/02/21 19:05:39:138 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook The known_hosts file is not present
    [11/02/21 19:05:39:138 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook ANSIBLE_HOST_KEY_CHECKING=<notset>
    [11/02/21 19:05:40:049 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook No config file found; using defaults
    [11/02/21 19:05:40:438 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook 
    [11/02/21 19:05:40:438 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook PLAY [Test Connection] *********************************************************
    [11/02/21 19:05:40:447 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook 
    [11/02/21 19:05:40:447 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook TASK [test : Check PowerShell Version] *****************************************
    [11/02/21 19:05:46:192 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook changed: [test-server.example.com] => {"changed": true, "cmd": "Write-Output (\"PowerShell version: \" + $PSVersionTable.PSVersion.Major + \".\" + $PSVersionTable.PSVersion.Minor)\nif ($PSVersionTable.PSVersion.Major -lt 5) {\n  Write-Output \"ERROR: PowerShell version 5 or later is required.\"\n  Exit 25\n}", "delta": "0:00:00.921839", "end": "2021-11-02 07:05:45.760941", "rc": 0, "start": "2021-11-02 07:05:44.839102", "stderr": "", "stderr_lines": [], "stdout": "PowerShell version: 5.1\r\n", "stdout_lines": ["PowerShell version: 5.1"]}
    [11/02/21 19:05:46:196 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook 
    [11/02/21 19:05:46:196 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook PLAY RECAP *********************************************************************
    [11/02/21 19:05:46:196 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook test-server.example.com  : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
    [11/02/21 19:05:46:197 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook 
    [11/02/21 19:05:46:264 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook Here is the standard error of the command (if any):
    
    [11/02/21 19:05:46:265 UTC] 1    com.ibm.ws.automation.core.runbook.runner.AnsibleRunner INFO runRunbook Identity added: /was/win/ssh_private_key_file (example.user@example.com)
    [11/02/21 19:05:46:265 UTC] 1    com.ibm.ws.automation.core.runbook.runner.RunbookRunnerCLI INFO start Ansible return code=0
    [11/02/21 19:05:46:265 UTC] 1    com.ibm.ws.automation.core.runbook.runner.RunbookRunnerCLI INFO stop Runbook Runner Stopping
    

    明確なエラー・メッセージまたは完了メッセージがない場合は、キーワード stdoutstdout_linesstderr および stderr_linesを検索してください。

    注: サーバーが PowerShell バージョン要件を満たしている場合でも、 PowerShell 要件行が表示されることがあります。 このステートメントは無視できます。
接続のテスト中に問題が発生した場合は、以下のトラブルシューティングのヒントを参照してください。
wsa-ansible または wsa-ansible-win 秘密鍵が欠落している
ERROR: The /was/ssh directory with the Ansible connection
        parameters is empty. Make sure the wsa-ansible secret exists.

wsa-ansible または wsa-ansible-win 秘密鍵が、SSH または WinRM 接続パラメーターで欠落しています。 セキュアなリモートアクセスの設定を参照してください。

ホスト名を解決できない
Failed to connect to the host via ssh: ssh: Could not
        resolve hostname <hostname>

一部のサーバーは、DNSで解決できないホスト名で構成されている場合があります。 このような場合は、カスタム・ホスト・マッピングを使用して WebSphere Automation を構成する必要がある場合があります。 WebSphereAutomation カスタムリソースの`hosts .runbookManager.runbookRunner.hostAliases `パラメータを使用して、追加のホストまたはIPマッピングを提供します。 例:

apiVersion: automation.websphere.ibm.com/v1
kind: WebSphereAutomation
metadata:
  name: wsa
spec:
  runbookManager:
    runbookRunner:
      hostAliases:
      - hostnames:
        - myvm
        ip: 9.46.84.208
ホスト鍵の検査に失敗
Failed to connect to the host via ssh: Host key verification
        failed.

WebSphere Automation によって、サーバーが変更したホストキー以外のホストキーが検査されます。 ホスト・キーの変更が意図的だった場合は、更新されたキーを使用して wsa-ansible-known-hosts 構成を更新してください。 詳細については、SSH による Linux または UNIX サーバーへの接続のための WebSphere オートメーションの設定を参照してください。