How to login using serverspec using ssh key? The serverspec doc indicates that it is possible to login using ssh and serverspec:


require 'highline/import'

if ENV['ASK_LOGIN_PASSWORD']
  options[:password] = ask("\nEnter login password: ") { |q| q.echo = false }
else
  options[:password] = ENV['LOGIN_PASSWORD']
end

set :ssh_options, options



How to login using an ssh key?
serverspec is using this Ruby class to ssh to servers

One should set the path to the key into the ~/.ssh/config file:

Host X
    HostName X
    User Y
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/Z


Now rake spec runs the test on the server.