On Saturday, February 22, 2014 9:12:54 PM UTC+1, dbray wrote: > > look at using hostfilter instead > > > http://stackoverflow.com/questions/429816/how-to-deploy-to-a-single-specific-server-using-capistrano >
HOSTFILTER do not work as I wanted, indeed HOSTFILTER behaves the same as my ROLES try. (pastie whit new output) http://pastie.org/8764556 I want to partially apply a series of tasks and my problem is not to limiting servers. My problem is once I limit server via HOSTS, ROLES, HOSTFILTER or HOSTROLEFILTER the servers chosen behaves like it belongs to all roles and apply tasks I dont want to apply in a chain. And I need a way to limit servers which only apply the tasks which belogns to the roles declared in the limited servers So my goal with this (simple example) Capfile http://pastie.org/8764626 is be able to limit server only to 127.1.1.1 and apply only do_all -> do_db and not do_app and do_web But sems that the code behind ROLES stuff states "Pick the servers whit role <$ROLES> and apply to it all tasks" instead of "Pick the servers whit role <$ROLES> and apply to it <$ROLES> tasks" > > > On Sat, Feb 22, 2014 at 2:30 AM, Carlos Peñas <[email protected]<javascript:> > > wrote: > >> Hi >> >> In capistrano 2.15 I'm getting some trouble limiting task execution, >> using ROLES environment variables >> >> if I use ROLES=role and call a task which have some "after" hooks, the >> tasks indicated by these hooks are called regardless the roles indicated >> in the task. >> >> For example in this example cap file: >> >> server "127.0.0.1", :web, :app >> server "127.1.1.1", :app, :db >> >> task :do_all do >> run "echo hi do all" >> end >> >> task :do_db, :roles => :db do >> run "echo hi do db" >> end >> after :do_all, :do_db >> >> task :do_app, :roles => :app do >> run "echo hi do app" >> end >> after :do_all, :do_app >> >> task :do_web, :roles => :db do >> run "echo hi do web" >> end >> after :do_all, :do_web >> >> If I call ROLES="db" cap do_all >> >> I get: >> >> * 2014-02-22 11:15:33 executing `do_all' >> * executing "echo hi do all" >> servers: ["127.1.1.1"] >> Password: >> [127.1.1.1] executing command >> ** [out :: 127.1.1.1] hi do all >> command finished in 13ms >> triggering after callbacks for `do_all' >> * 2014-02-22 11:15:44 executing `do_db' >> * executing "echo hi do db" >> servers: ["127.1.1.1"] >> [127.1.1.1] executing command >> ** [out :: 127.1.1.1] hi do db >> command finished in 3ms >> * 2014-02-22 11:15:44 executing `do_app' >> * executing "echo hi do app" >> servers: ["127.1.1.1"] >> [127.1.1.1] executing command >> ** [out :: 127.1.1.1] hi do app >> command finished in 3ms >> * 2014-02-22 11:15:44 executing `do_web' >> * executing "echo hi do web" >> servers: ["127.1.1.1"] >> [127.1.1.1] executing command >> ** [out :: 127.1.1.1] hi do web >> command finished in 3ms >> >> So the ROLES variable is limiting the server to apply the tasks but not >> the tasks applied. I'd expected do_all, do_db but not do_web and do_app >> >> Is there a way to achieve the behavior I expected? Im stuck in this >> scheme of after :this, :do_that and I really need do partial task apply >> to a role >> >> Thanks. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Capistrano" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To view this discussion on the web, visit >> https://groups.google.com/d/msgid/capistrano/5187fb3e-6e14-42ea-82c1-1c162d174d5f%40googlegroups.com >> . >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- You received this message because you are subscribed to the Google Groups "Capistrano" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/d048240e-6f86-48e5-82e8-2e6e290dfbe4%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
