ruby - Capistrano: create tasks with roles did not work -
i try create tasks different roles :
namespace :foo task :mytasks, :roles => [:a, :b,] task_a task_b end task :task_a, :roles => :a run 'echo a' end task :task_b, :roles => :b run 'echo b' end end when execute 'mytasks' here result :
$ cap -n roles=b foo:mytasks * 2013-03-01 16:59:14 executing `foo:mytasks' * executing "echo a" * executing "echo b" all tasks executed, why ?
capistrano roles intended associate given server (or multiple servers) particular function, such saying "machine-a" web server while "machine-b" database server, useful because tasks need performed on machines.
so roles not intended way conditionally select machine(s) run tasks on @ time when running capistrano, select tasks should run on machines.
there is, however, capistrano feature called multistage may you're looking for. allows specify different sets of servers (and associate them different roles) based on "stage" you're deploying to. have a , b stages, each separate sets of servers, deploy using:
cap foo:mytasks cap b foo:mytasks
Comments
Post a Comment