安装指定版本capistrano

时间:2021-12-27 22:17:40
1、ruby安装
#yum install -y openssl-devel readline-devel zlib-devel git
#git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv
设置环境变量:
[root@pre-storm-a1 profile.d]# more rbenv.sh
export RBENV_ROOT=/usr/local/rbenv
export PATH=$RBENV_ROOT/bin:$PATH
eval "$(rbenv init -)"
#git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
# rbenv install 2.2.6
# rbenv global 2.2.6
2.安装capistrano(v2.15)
#gem install capistrano -v 2.15 -V
3.修改capistrano代码,支持多个不同密码机器部署
# vim /usr/local/rbenv/versions/2.2.6/lib/ruby/gems/2.2.0/gems/capistrano-2.15.0/lib/capistrano/ssh.rb 
在81行: begin 后加入
 
        if options[:passwords]
servers_array = options.roles[:app].servers.collect {|server| server.host}
index = servers_array.index(host)
real_password = options[:passwords][index]
password_value = real_password
puts "support multi password #{host}"
end