我有一个简化的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),它就能正确地完成所有事情。
我出错了吗?