ansible/ansible — pull request #8341 by AlexRiedler (2014-07-29 17:58:19+00:00)
Title: ssh - make known_hosts check compatible with entire format

# Fix Known Hosts SSH Issues
## Existing issues
- Currently the implementation works by looking up the `known_hosts` file (by assuming it is in the default location) this is not always the case.
- It does not check the `ssh_config` which may have HostAlias's or specially set identities
- It does not support ? and * operators
- It assumes the host is in the file even if it is a prefix of another host
- It does not support different ports with different host keys (e.g. forwarded ports with different end machines)

## Solution
This fix works by using `ssh-keygen` and its `-F` parameter to determine if the set of potential hosts is available. See code for better details.

Also Fixes: https://github.com/ansible/ansible/issues/8333

Always open for debate and changes :smiley_cat: