Capistrano 3 discards :user variable when executing remote SSH command

Viewed 6205

Trying to test Capistrano from scratch.

Capfile:

require 'capistrano/setup'
require 'capistrano/deploy'
I18n.enforce_available_locales = false
Dir.glob('lib/capistrano/tasks/*.rb').each { |r| import r }

deploy.rb:

role :testrole, 'x.x.x.x'
set :user, 'ubuntu'

The test.rb task:

namespace :test do
desc "Uptime on servers"
task :uptime do
  on roles(:testrole) do
    execute "uptime" 
  end
end
 end

cap command:

cap production test:uptime

output:

INFO [c077da7f] Running /usr/bin/env uptime on x.x.x.x
DEBUG [c077da7f] Command: /usr/bin/env uptime
cap aborted!
Net::SSH::AuthenticationFailed

Dont have a problem to login from the shell using the same user and key. While logged in the remote server, I can see in auth.log that an empty user given while executing the cap:

test-srv sshd[1459]: Invalid user  from x.x.x.x

What do I miss ? Thanks!

1 Answers
Related