Capistrano:运行上限部署:安装ROLES = role1在role1服务器上运行所有任务

时间:2012-09-13 10:26:03

标签: ruby-on-rails deployment capistrano

我有一个简化的capistrano部署设置看起来像这样:

server "server_ip1", :role1
server "server_ip2", :role2

还有一对任务

namespace :postgresql do
  desc "Install necessary ubuntu packages"
  task :install, roles: [:role2] do
    run "#{sudo} apt-get -y install postgresql libpq-dev"
  end
  after "deploy:install", "postgresql:install"
end

namespace :app_install do
  desc "Install necessary ubuntu packages"
  task :install, roles: [:role1, :role2] do
    run "#{sudo} apt-get -y install imagemagick"
  end
  after "deploy:install", "app_install:install"
end

现在问题是如果我运行cap deploy:install ROLES=role1它正确运行server_ip1上的任务但是它运行两个任务app_install:install AND postgresql:install

有趣的是,如果我运行cap deploy:install(没有ROLES = role1),它就能正确地完成所有事情。

我出错了吗?

1 个答案:

答案 0 :(得分:0)