Categories
Mastering Development System & Network

Ansible SSH connection closed

I have a little problem with ansible.
I’m running it in a container:

ansible 2.7.7
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.7.3 (default, Dec 20 2019, 18:57:59) [GCC 8.3.0]

I want to create an artefact in one host (Packer) and send it in a group of hosts (Proxmox).
The artefact is created no problem with it, the tricky point is the upload.
Here is my code:

---

    - name: Test
      file:
        path: /tmp/Test
        state: touch
      delegate_to: ""
      tags: 
        - Proxmox
        - touch

    - name: Sending artifact on Proxmox machines
      synchronize:
        src: /tmp/template/Output-file1.mf
        dest: /tmp/Output-file1.mf
      delegate_to: ""
      tags:
        - Proxmox
        - sync

The 1st task is OK, the Test file is created on the Packer Host, prooving that the SSH connexion is operational.

The problem occurs on the 2nd task:

TASK [download : Sending artifact on Proxmox machines] *****************************************************************************************************************************************************************************************************
task path: /code/roles/download/tasks/main.yaml:12
Read vars_file './secrets.yaml'
Read vars_file './secrets.yaml'
<192.168.1.69> ESTABLISH SSH CONNECTION FOR USER: jerome
<192.168.1.69> SSH: EXEC sshpass -d14 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d 192.168.1.69 '/bin/sh -c '"'"'echo ~jerome && sleep 0'"'"''
<192.168.1.69> (0, b'/Users/jerome\n', b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.1.69> ESTABLISH SSH CONNECTION FOR USER: jerome
<192.168.1.69> SSH: EXEC sshpass -d14 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d 192.168.1.69 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0440042-124922614268739 `" && echo ansible-tmp-1590246409.0440042-124922614268739="` echo /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0440042-124922614268739 `" ) && sleep 0'"'"''
<192.168.1.69> ESTABLISH SSH CONNECTION FOR USER: jerome
<192.168.1.69> SSH: EXEC sshpass -d14 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d 192.168.1.69 '/bin/sh -c '"'"'echo ~jerome && sleep 0'"'"''
<192.168.1.69> (0, b'ansible-tmp-1590246409.0440042-124922614268739=/Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0440042-124922614268739\n', b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.1.69> (0, b'/Users/jerome\n', b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.1.69> ESTABLISH SSH CONNECTION FOR USER: jerome
<192.168.1.69> SSH: EXEC sshpass -d14 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d 192.168.1.69 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0874155-34347585212584 `" && echo ansible-tmp-1590246409.0874155-34347585212584="` echo /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0874155-34347585212584 `" ) && sleep 0'"'"''
<192.168.1.69> (0, b'ansible-tmp-1590246409.0874155-34347585212584=/Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0874155-34347585212584\n', b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
Using module file /usr/lib/python3/dist-packages/ansible/modules/files/synchronize.py
Using module file /usr/lib/python3/dist-packages/ansible/modules/files/synchronize.py
<192.168.1.69> PUT /root/.ansible/tmp/ansible-local-2942lvy6sp_q/tmpcqvbocif TO /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0440042-124922614268739/AnsiballZ_synchronize.py
<192.168.1.69> PUT /root/.ansible/tmp/ansible-local-2942lvy6sp_q/tmppr419rda TO /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0874155-34347585212584/AnsiballZ_synchronize.py
<192.168.1.69> SSH: EXEC sshpass -d14 sftp -o BatchMode=no -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d '[192.168.1.69]'
<192.168.1.69> SSH: EXEC sshpass -d14 sftp -o BatchMode=no -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d '[192.168.1.69]'
<192.168.1.69> (0, b'sftp> put /root/.ansible/tmp/ansible-local-2942lvy6sp_q/tmppr419rda /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0874155-34347585212584/AnsiballZ_synchronize.py\n', b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "posix-rename@openssh.com" revision 1\r\ndebug2: Server supports extension "statvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "fstatvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "hardlink@openssh.com" revision 1\r\ndebug2: Server supports extension "fsync@openssh.com" revision 1\r\ndebug2: Unrecognised server extension "lsetstat@openssh.com"\r\ndebug3: Sent message fd 3 T:16 I:1\r\ndebug3: SSH_FXP_REALPATH . -> /Users/jerome size 0\r\ndebug3: Looking up /root/.ansible/tmp/ansible-local-2942lvy6sp_q/tmppr419rda\r\ndebug3: Sent message fd 3 T:17 I:2\r\ndebug3: Received stat reply T:101 I:2\r\ndebug1: Couldn\'t stat remote file: No such file or directory\r\ndebug3: Sent message SSH2_FXP_OPEN I:3 P:/Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0874155-34347585212584/AnsiballZ_synchronize.py\r\ndebug3: Sent message SSH2_FXP_WRITE I:4 O:0 S:32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 4 32768 bytes at 0\r\ndebug3: Sent message SSH2_FXP_WRITE I:5 O:32768 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:6 O:65536 S:10733\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 5 32768 bytes at 32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 6 10733 bytes at 65536\r\ndebug3: Sent message SSH2_FXP_CLOSE I:4\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.1.69> (0, b'sftp> put /root/.ansible/tmp/ansible-local-2942lvy6sp_q/tmpcqvbocif /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0440042-124922614268739/AnsiballZ_synchronize.py\n', b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "posix-rename@openssh.com" revision 1\r\ndebug2: Server supports extension "statvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "fstatvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "hardlink@openssh.com" revision 1\r\ndebug2: Server supports extension "fsync@openssh.com" revision 1\r\ndebug2: Unrecognised server extension "lsetstat@openssh.com"\r\ndebug3: Sent message fd 3 T:16 I:1\r\ndebug3: SSH_FXP_REALPATH . -> /Users/jerome size 0\r\ndebug3: Looking up /root/.ansible/tmp/ansible-local-2942lvy6sp_q/tmpcqvbocif\r\ndebug3: Sent message fd 3 T:17 I:2\r\ndebug3: Received stat reply T:101 I:2\r\ndebug1: Couldn\'t stat remote file: No such file or directory\r\ndebug3: Sent message SSH2_FXP_OPEN I:3 P:/Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0440042-124922614268739/AnsiballZ_synchronize.py\r\ndebug3: Sent message SSH2_FXP_WRITE I:4 O:0 S:32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 4 32768 bytes at 0\r\ndebug3: Sent message SSH2_FXP_WRITE I:5 O:32768 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:6 O:65536 S:10735\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 5 32768 bytes at 32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 6 10735 bytes at 65536\r\ndebug3: Sent message SSH2_FXP_CLOSE I:4\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.1.69> ESTABLISH SSH CONNECTION FOR USER: jerome
<192.168.1.69> ESTABLISH SSH CONNECTION FOR USER: jerome
<192.168.1.69> SSH: EXEC sshpass -d14 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d 192.168.1.69 '/bin/sh -c '"'"'chmod u+x /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0874155-34347585212584/ /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0874155-34347585212584/AnsiballZ_synchronize.py && sleep 0'"'"''
<192.168.1.69> SSH: EXEC sshpass -d14 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d 192.168.1.69 '/bin/sh -c '"'"'chmod u+x /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0440042-124922614268739/ /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0440042-124922614268739/AnsiballZ_synchronize.py && sleep 0'"'"''
<192.168.1.69> (0, b'', b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.1.69> (0, b'', b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<192.168.1.69> ESTABLISH SSH CONNECTION FOR USER: jerome
<192.168.1.69> ESTABLISH SSH CONNECTION FOR USER: jerome
<192.168.1.69> SSH: EXEC sshpass -d14 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d -tt 192.168.1.69 '/bin/sh -c '"'"'/usr/bin/python /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0440042-124922614268739/AnsiballZ_synchronize.py && sleep 0'"'"''
<192.168.1.69> SSH: EXEC sshpass -d14 ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o User=jerome -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/0e5690fa3d -tt 192.168.1.69 '/bin/sh -c '"'"'/usr/bin/python /Users/jerome/.ansible/tmp/ansible-tmp-1590246409.0874155-34347585212584/AnsiballZ_synchronize.py && sleep 0'"'"''
<192.168.1.69> (255, b"\rjerome@192.168.1.83's password: ", b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Control master terminated unexpectedly\r\nShared connection to 192.168.1.69 closed.\r\n')
<192.168.1.69> (255, b"\rjerome@192.168.1.1's password: ", b'OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Control master terminated unexpectedly\r\nShared connection to 192.168.1.69 closed.\r\n')
fatal: [192.168.1.83]: UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Control master terminated unexpectedly\r\nShared connection to 192.168.1.69 closed.",
    "unreachable": true
}
fatal: [192.168.1.1]: UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: OpenSSH_7.9p1 Debian-10+deb10u2, OpenSSL 1.1.1d  10 Sep 2019\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug2: resolve_canonicalize: hostname 192.168.1.69 is address\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 = 3016\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Control master terminated unexpectedly\r\nShared connection to 192.168.1.69 closed.",
    "unreachable": true
}

It seems to be a problem in my ssh_config file but I don’t understand what is wrong

Leave a Reply

Your email address will not be published. Required fields are marked *