簡體   English   中英

Ansible ssh 錯誤:mux_client_read_packet:讀取 header 失敗:損壞 pipe 從主機接收到退出狀態

[英]Ansible ssh error: mux_client_read_packet: read header failed: Broken pipe Received exit status from master

我在遠程remotehost (即10.0.0.211 )上有一個腳本/wd/remoteuser/stopALL.sh ,需要 3 秒才能完成執行,並且對 remoteuser 具有完全權限 775。

注意: /wd/remoteuser/stopALL.s h 在運行 ansible 的主機上不存在。

我希望從我的ansiblehost觸發remotehost上的停止腳本。

下面是我如何運行我的 ansible 劇本。

ansible-playbook /app/playbook/ovs.yml -i /app/playbook/ovs.hosts -t stop -f 5 -e Environment=PROD -e Country=SRILANKA -vvvv

cat /app/playbook/ovs.yml

---
- name: Play 1- check for login and mount point
  hosts: "*{{ Country }}_{{ Environment }}"
  user: "{{ USER }}"
  any_errors_fatal: true
  vars:
    ansible_ssh_extra_args: -o StrictHostKeyChecking=no -o ConnectTimeout=90 -o ServerAliveInterval=50
    ansible_ssh_private_key_file: /app/ssh_keys/id_rsa
  gather_facts: false

  tasks:

    - name: Execute backup stop1 script
      tags: stop,restart
      script: "{{ stopscript }}"
      args:
        chdir: "{{ stopscript | dirname }}"
      register: stopscriptoutput


    - name: Debug stopscript
      tags: stop,restart
      debug:
        msg: "{{ stopscriptoutput.stdout }}"

cat /app/playbook/ovs.hosts

[APP_SRILANKA_PROD]
10.0.0.211 USER=remoteuser stopscript=/wd/remoteuser/stopALL.sh countrydet=SRILANKA evt=PROD

Output:

<10.0.0.211> (0, '', 'OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 58: Applying options for *\r\ndebug3: kex names ok: [curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,gss-gex-sha1-,gss-group14-sha1-]\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 190236\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
fatal: [10.0.0.211]: FAILED! => {
    "changed": false,
    "msg": "Could not find or access '/wd/remoteuser/stopALL.sh' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"
}

NO MORE HOSTS LEFT *****************************************************************************************************************************************************

PLAY RECAP *************************************************************************************************************************************************************
10.0.0.211                : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

我得到這個 ssh read header failed: Broken pipe 錯誤,即使我使用shell模塊,如下所示。

- name: Execute backup stop1 script
  tags: stop
  shell: "sleep 90; {{ stopscript }}; sleep 90"
  register: stopscriptoutput

請建議我如何解決 ssh 損壞的 pipe 錯誤並讓腳本遠程執行?

在環境變量中設置代理並開始工作

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM