pwmb2g
Last Updated: February 25, 2016
·
538
· theist

Capistrano settings for Vagrant

Capistrano 3

Specify a host and ssh config for vagrant machines in capistrano V3

server 'vagrant', user: 'vagrant', roles: %w{web app db},
  ssh_options: {
    forward_agent: true,
    host_name: '127.0.0.1',
    port: '2222',
    keys: ["#{ENV['HOME']}/.vagrant.d/insecure_private_key"]
  }

Notes:

server 'servername' allows to give localhost an alias, so you won't mix commands on the log if there are many vagrant hosts

host_name let's you to specify the real IP or hostname of the targeted host. If it isn't here it uses servername as real hostname

keys array which specifies the automated insecure key installed by vagrant on your home. if it isn't here change accordingly

Capistrano 2

set :user, "vagrant"
ssh_options[:keys] = ["#{ENV['HOME']}/.vagrant.d/insecure_private_key"]
ssh_options[:port] = 2222
ssh_options[:forward_agent] = true

1 Response
Add your response

17502

Does it matter whether I'm using private or public networking on the Vagrant instance?

over 1 year ago ·
Filed Under