Synchronize module troubleshoot

Hi all,

I am new to Ansible and trying to use synchronize module, but it just stuck in the middle and I can not figure out how to troubleshoot this. Can anyone help?

<> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ‘User=“ansibleuser”’ -o ConnectTimeout=10 -o ControlPath=/home/abc/.ansible/cp/be86fc6f7e -tt xxx.xxx.xxx.xxx ‘/bin/sh -c ‘"’"’/usr/bin/python3 /home/ansibleuser/.ansible/tmp/ansible-tmp-1671215842.4024777-2122152-168151047792095/AnsiballZ_synchronize.py && sleep 0’“'”’

Thank you,
Indirajith

If possible, can you post the entire output? That looks like it’s just the ssh connect string, and I am not seeing any error there, which makes me think the error is probably elsewhere in your output.

–John

Thank you John,

The entire output is as follows. I don’t get any error, it just waits forever without returning anything, I have to end it by ctrl+c.

<a.b.c.d> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<a.b.c.d> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/be86fc6f7e a.b.c.d '/bin/sh -c '"'"'echo ~ansibleuser && sleep 0'"'"''
<a.b.c.d> (0, b'/home/ansibleuser\n', b'OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname a.b.c.d 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 = 2164684\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')
<a.b.c.d> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<a.b.c.d> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/be86fc6f7e a.b.c.d '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansibleuser/.ansible/tmp `"&& mkdir "` echo /home/ansibleuser/.ansible/tmp/ansible-tmp-1671315155.764345-2164717-127377077541884 `" && echo ansible-tmp-1671315155.764345-2164717-127377077541884="` echo /home/ansibleuser/.ansible/tmp/ansible-tmp-1671315155.764345-2164717-127377077541884 `" ) && sleep 0'"'"''
<a.b.c.d> (0, b'ansible-tmp-1671315155.764345-2164717-127377077541884=/home/ansibleuser/.ansible/tmp/ansible-tmp-1671315155.764345-2164717-127377077541884\n', b'OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname a.b.c.d 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 = 2164684\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')
<137.44.6.56> Attempting python interpreter discovery
<a.b.c.d> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<a.b.c.d> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/be86fc6f7e a.b.c.d '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.9'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.8'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<a.b.c.d> (0, b'PLATFORM\nLinux\nFOUND\n/usr/bin/python3.8\n/usr/bin/python3\nENDFOUND\n', b'OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname a.b.c.d 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 = 2164684\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')
<a.b.c.d> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<a.b.c.d> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/be86fc6f7e a.b.c.d '/bin/sh -c '"'"'/usr/bin/python3.8 && sleep 0'"'"''
<a.b.c.d> (0, b'{"platform_dist_result": [], "osrelease_content": "NAME=\"Ubuntu\"\nVERSION=\"20.04.4 LTS (Focal Fossa)\"\nID=ubuntu\nID_LIKE=debian\nPRETTY_NAME=\"Ubuntu 20.04.4 LTS\"\nVERSION_ID=\"20.04\"\nHOME_URL=\"[https://www.ubuntu.com/\](https://www.ubuntu.com/\)"\nSUPPORT_URL=\"[https://help.ubuntu.com/\](https://help.ubuntu.com/\)"\nBUG_REPORT_URL=\"[https://bugs.launchpad.net/ubuntu/\](https://bugs.launchpad.net/ubuntu/\)"\nPRIVACY_POLICY_URL=\"[https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\](https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\)"\nVERSION_CODENAME=focal\nUBUNTU_CODENAME=focal\n"}\n', b'OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname a.b.c.d 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 = 2164684\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 /home/user/.local/lib/python3.8/site-packages/ansible_collections/ansible/posix/plugins/modules/synchronize.py
<a.b.c.d> PUT /home/user/.ansible/tmp/ansible-local-21646995ou9wqzi/tmpj99bq8ua TO /home/ansibleuser/.ansible/tmp/ansible-tmp-1671315155.764345-2164717-127377077541884/AnsiballZ_synchronize.py
<a.b.c.d> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/be86fc6f7e '[a.b.c.d]'
<a.b.c.d> (0, b'sftp> put /home/user/.ansible/tmp/ansible-local-21646995ou9wqzi/tmpj99bq8ua /home/ansibleuser/.ansible/tmp/ansible-tmp-1671315155.764345-2164717-127377077541884/AnsiballZ_synchronize.py\n', b'OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname a.b.c.d 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 = 2164684\r\ndebug3: mux_client_request_session: session request sent\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "[posix-rename@openssh.com](mailto:posix-rename@openssh.com)" revision 1\r\ndebug2: Server supports extension "[statvfs@openssh.com](mailto:statvfs@openssh.com)" revision 2\r\ndebug2: Server supports extension "[fstatvfs@openssh.com](mailto:fstatvfs@openssh.com)" revision 2\r\ndebug2: Server supports extension "[hardlink@openssh.com](mailto:hardlink@openssh.com)" revision 1\r\ndebug2: Server supports extension "[fsync@openssh.com](mailto:fsync@openssh.com)" revision 1\r\ndebug2: Server supports extension "[lsetstat@openssh.com](mailto:lsetstat@openssh.com)" revision 1\r\ndebug3: Sent message fd 3 T:16 I:1\r\ndebug3: SSH_FXP_REALPATH . -> /home/ansibleuser size 0\r\ndebug3: Looking up /home/user/.ansible/tmp/ansible-local-21646995ou9wqzi/tmpj99bq8ua\r\ndebug3: Sent message fd 3 T:17 I:2\r\ndebug3: Received stat reply T:101 I:2\r\ndebug1: Couldn

Thanks and regards,
Indirajith.t stat remote file: No such file or directory\r\ndebug3: Sent message SSH2_FXP_OPEN I:3 P:/home/ansibleuser/.ansible/tmp/ansible-tmp-1671315155.764345-2164717-127377077541884/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:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:7 O:98304 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:8 O:131072 S:808\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 32768 bytes at 65536\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 7 32768 bytes at 98304\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 8 808 bytes at 131072\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')
<a.b.c.d> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<a.b.c.d> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/be86fc6f7e a.b.c.d '/bin/sh -c '"'"'chmod u+x /home/ansibleuser/.ansible/tmp/ansible-tmp-1671315155.764345-2164717-127377077541884/ /home/ansibleuser/.ansible/tmp/ansible-tmp-1671315155.764345-2164717-127377077541884/AnsiballZ_synchronize.py && sleep 0'"'"''
<a.b.c.d> (0, b'', b'OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f 31 Mar 2020\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files\r\ndebug1: /etc/ssh/ssh_config line 21: Applying options for *\r\ndebug2: resolve_canonicalize: hostname a.b.c.d 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 = 2164684\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')
<a.b.c.d> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<a.b.c.d> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/be86fc6f7e -tt a.b.c.d '/bin/sh -c '"'"'/usr/bin/python3 /home/ansibleuser/.ansible/tmp/ansible-tmp-1671315155.764345-2164717-127377077541884/AnsiballZ_synchronize.py && sleep 0'"'"''

Thanks and regards,
Indirajith.

I would look at the ssh log on the client. If it’s just sitting there, that tells me that your problem may be elsewhere, and not with the synchronize module. Also, make sure that rsync is installed on the client as well, that is a requirement. Although, I think if it weren’t there, that synchronize would complain about that. I would also try something like an ansible ping or something, using the same user, etc to try and further narrow the scope of the problem down.

–John