SSH connection to host failed..

Hello Guys,

Can someone of you help me with this strange case? I have host running CentOS 6.7 x86_64. My ansible management host is CentOS 7.2 x86_64, ansible version 1.9.4. When I try to run playbook against my host I’m getting this message:

GATHERING FACTS ***************************************************************
failed: [vzylvrnddev3] => {“failed”: true, “parsed”: false}
/var/tmp/sclAxMdst: line 8: -k: command not found
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: auto-mux: Trying existing master
debug1: mux_client_request_session: master session id: 2
Shared connection to vzylvrnddev3 closed.

for more info:

GATHERING FACTS ***************************************************************
ESTABLISH CONNECTION FOR USER: ansible
REMOTE_MODULE setup
EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/ansible-admin/.ansible/cp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 vzylvrnddev3 /bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1458307518.98-232218326920679 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1458307518.98-232218326920679 && echo $HOME/.ansible/tmp/ansible-tmp-1458307518.98-232218326920679’
PUT /tmp/tmpCkdV99 TO /home/ansible/.ansible/tmp/ansible-tmp-1458307518.98-232218326920679/setup
EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=“/home/ansible-admin/.ansible/cp/ansible-ssh-%h-%p-%r” -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=ansible -o ConnectTimeout=10 vzylvrnddev3 /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-; LANG=C LC_CTYPE=C /usr/bin/python /home/ansible/.ansible/tmp/ansible-tmp-1458307518.98-232218326920679/setup; rm -rf /home/ansible/.ansible/tmp/ansible-tmp-1458307518.98-232218326920679/ >/dev/null 2>&1’”‘"’’
failed: [vzylvrnddev3] => {“failed”: true, “parsed”: false}
/var/tmp/sclRLbVXV: line 8: -k: command not found
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: auto-mux: Trying existing master
debug2: fd 3 setting O_NONBLOCK
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_client_request_alive: done pid = 5502
debug3: mux_client_request_session: session request sent
debug1: mux_client_request_session: master session id: 2
debug3: mux_client_read_packet: read header failed: Broken pipe
debug2: Received exit status from master 127
Shared connection to vzylvrnddev3 closed.

Any idea why I’m getting this message? I restored /etc/ssh/sshd_config and ssh_config to default - it’s still the same. What is the reason?

thanks in advance!

I have nearly the exact same issue. Have you managed to find a solution?

ConnectTimeout=10 vzylvrnddev3 /bin/sh -c 'sudo -k && sudo -H -S -p
"[sudo via ansible, key=] password: " -u root /bin/sh -c '"'"'echo
BECOME-SUCCESS-; LANG=C LC_CTYPE=C /usr/bin/python
/home/ansible/.ansible/tmp/ansible-tmp-1458307518.98-232218326920679/setup;
rm -rf /home/ansible/.ansible/tmp/ansible-tmp-1458307518.98-232218326920679/

/dev/null 2>&1'"'"''

failed: [vzylvrnddev3] => {"failed": true, "parsed": false}
/var/tmp/sclRLbVXV: line 8: -k: command not found

Does the sudo on the host not understand the '-k' flag?

As it turns out, in my case the issue was that sftp was purposefully unsupported on the remote machine. Switching to scp solved this problem.