Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible hides SSH errors #16732

Closed
kustodian opened this issue Jul 15, 2016 · 7 comments
Closed

Ansible hides SSH errors #16732

kustodian opened this issue Jul 15, 2016 · 7 comments

Comments

@kustodian
Copy link
Contributor

@kustodian kustodian commented Jul 15, 2016

ISSUE TYPE

Bug Report

COMPONENT NAME

core

ANSIBLE VERSION
ansible 2.1.1.0
CONFIGURATION

N/A

OS / ENVIRONMENT
SUMMARY

When an SSH error occurs Ansible only reports something like:

failed: [host-14] (item=1) => {"item": 1, "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", "unreachable": true}

It hides the actual error which is reported by SSH which makes it very hard to troubleshoot problems with SSH.
Ansible should print the actual SSH error, like it did in the older version, at least in higher verbosity levels.

STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
@alikins
Copy link
Contributor

@alikins alikins commented Jul 15, 2016

#16649 is more or less along the same line.

Though I'd say there are two bugs (or could be two prs). One to not hide stderr, the other to do something with it.

@paulRbr
Copy link
Contributor

@paulRbr paulRbr commented Sep 6, 2017

I have noticed the same issue while spending 3 hours to debug a deployment that was not working on a test environment.

After the 3 hours analysis we have notices with my colleague that we had the problem when pipelining = True was activated on Ansible.

Digging further we clearly saw this line is a potential culprit:

except (OSError, IOError):
raise AnsibleConnectionFailure('SSH Error: data could not be sent to remote host "%s". Make sure this host can be reached over ssh' % self.host)

Indeed this error hides any OSError or IOError error that could occur during the ssh connection.
Issue #28870 is clearly the same problem (an OSError that gets hidden from Ansible).

I am not very confident in making changes in Ansible's codebase but @alikins do you think we could simply remove this raise and let the real exception pop?

@ansibot ansibot added bug and removed bug_report labels Mar 1, 2018
@gundalow
Copy link
Contributor

@gundalow gundalow commented Feb 22, 2019

Hi, there have been many PRs merged that have improved SSH logging.

Is this still an issue?
@paulRbr If there still are issues a PR would be welcome and we could discuss improvements in there.

needs_info

@ansibot ansibot added the needs_info label Feb 22, 2019
@JulienPalard
Copy link
Contributor

@JulienPalard JulienPalard commented Mar 15, 2019

This is still an issue in AWX with ansible 2.7.7, where I see:

{
    "msg": "SSH Error: data could not be sent to remote host \"...\". Make sure this host can be reached over ssh",
    "unreachable": true,
    "changed": false
}

but strace gives me:

13545 write(2, "No ECDSA host key is known for ... and you have requested strict checking.\r\n", 86) = 86
13545 write(2, "Host key verification failed.\r\n", 31 <unfinished ...>
@ansibot
Copy link
Contributor

@ansibot ansibot commented Mar 31, 2019

@kustodian This issue is waiting for your response. Please respond or the issue will be closed.

click here for bot help

@ansibot
Copy link
Contributor

@ansibot ansibot commented May 2, 2019

@kustodian You have not responded to information requests in this issue so we will assume it no longer affects you. If you are still interested in this, please create a new issue with the requested information.

click here for bot help

@ansibot ansibot closed this May 2, 2019
@JulienPalard
Copy link
Contributor

@JulienPalard JulienPalard commented May 12, 2019

@ansibot Woh! no no no! It still affects me þ

@ansible ansible locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
8 participants
You can’t perform that action at this time.