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

known_hosts module fail when ssh-keygen exit with 1 #23727

Closed
tdihp opened this issue Apr 19, 2017 · 9 comments
Closed

known_hosts module fail when ssh-keygen exit with 1 #23727

tdihp opened this issue Apr 19, 2017 · 9 comments
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category

Comments

@tdihp
Copy link

tdihp commented Apr 19, 2017

ISSUE TYPE

Bug Report

COMPONENT NAME

modules.system.known_hosts

ANSIBLE VERSION
ansible 2.3.0.0
  config file = /Users/pp/proj/barejenkins/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Dec 13 2016, 10:45:11) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
CONFIGURATION

not configuration specific

OS / ENVIRONMENT

Running Ansible from: Mac
Managing: Ubuntu 1604

SUMMARY

Using known_hosts to add a new host entry gives me an unexplained error

I'm pretty sure it's these lines in sanity_check (persist in devel branch too)

rc,stdout,stderr=module.run_command([sshkeygen,'-F',host,
                                     '-f',outf.name],
                                    check_rc=True)

While the other place with ssh-keygen -F allows rc==1

While I want to try fix this, I'm not able to get the test suite pass using either
ansible-test units --local (no pytest), or ansible-test units --docker (no python 2.6)

STEPS TO REPRODUCE
---
- hosts: myhost
tasks:
  - name: add some host that myhost haven't seen
    known_hosts:
      name: "other.host.name"
      key: "{{ some_rsa_public_key }}"
EXPECTED RESULTS

OK (changed)

ACTUAL RESULTS

fail with:

{"changed": false, "cmd": "/usr/bin/ssh-keygen -F other.host.name -f /tmp/tmpNWb8U9", "failed": true, "msg": "", "rc": 1, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}
@ansibot
Copy link
Contributor

ansibot commented Apr 19, 2017

cc @mcv21
click here for bot help

@ansibot ansibot added affects_2.3 This issue/PR affects Ansible v2.3 bug_report module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels Apr 19, 2017
@abadger abadger removed the needs_triage Needs a first human triage before being processed. label Apr 20, 2017
@ansibot ansibot added the support:community This issue/PR relates to code supported by the Ansible community. label Jun 29, 2017
@emestee
Copy link

emestee commented Aug 14, 2017

Observing the same in

ansible 2.3.1.0
config file = /home/emestee/src/ansible/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.12+ (default, Sep 17 2016, 12:08:02) [GCC 6.2.0 2016091]

@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. labels Nov 18, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 1, 2018
@adamchance365
Copy link

Still affects Ansible 2.4.1

@drzraf
Copy link
Contributor

drzraf commented May 21, 2018

Same here (Ansible 2.5.2)
The main issue being the impossibility to debug this since:

  • no informative error message is sent
  • even with ANSIBLE_KEEP_REMOTE_FILES=1 the temporary file is deleted.

In my case, check-mode fails too and the cause is a badly formatted key (should be <host> <key-type> <key>).
Sadly ssh-keygen -vv won't say anything about such an user error)

@sivel
Copy link
Member

sivel commented Aug 9, 2019

!component =lib/ansible/modules/system/known_hosts.py

@sivel
Copy link
Member

sivel commented Aug 9, 2019

bot_status

@ansibot
Copy link
Contributor

ansibot commented Aug 17, 2019

Components

lib/ansible/modules/system/known_hosts.py
support: community
maintainers: mcv21

Metadata

waiting_on: maintainer
needs_info: False

click here for bot help

@ansibot ansibot added module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. system System category and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 17, 2019
@ansibot
Copy link
Contributor

ansibot commented Aug 17, 2019

Components

lib/ansible/modules/system/known_hosts.py
support: community
maintainers: mcv21

Metadata

waiting_on: maintainer
needs_info: False

click here for bot help

@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed support:community This issue/PR relates to code supported by the Ansible community. labels Mar 29, 2020
@s-hertel
Copy link
Contributor

s-hertel commented Jan 22, 2021

This has been resolved by 13aff08 and there should be a more informative error message.

@ansible ansible locked and limited conversation to collaborators Feb 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category
Projects
None yet
Development

No branches or pull requests

8 participants