繁体   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