theforeman / hammer-cli-foreman-ssh

Adds Remote SSH support for Hammer Foreman CLI
Other
7 stars 6 forks source link

AuthenticationFailed #2

Closed jllucas closed 9 years ago

jllucas commented 9 years ago

Hi,

when doing:

hammer -d host ssh --command 'puppet agent -t' --search='XXXXXXXX' --no-dns where XXXXXXXX=hostname.domain

I get:

About to execute: puppet agent -t as user root on the following 1 hosts: XXXXXX Continue, (y/N) y error connecting to root@XXXXXX: Net::SSH::AuthenticationFailed (Authentication failed for user root@XXXXXX@XXXXXX)

++Note the error message has the hostname duplicated.

Looking at your code, I've added ":keys" to the following line:

  ssh_options = { :user => user, :auth_methods => ['publickey'], :keys => ["/path/to/pem"] }

in order to ssh to my machine using the correct PEM file. Before that I put my pem in this file and the public key in the "authorized_keys" of my machine. I generated a new gem and it's working for me, but I now this is not the best way to do it. Could you include something like a --pem-file functionality?

Regards