That's not possible, as the task body runs in parallel on all hosts.

On Wednesday, February 8, 2012 at 10:12 AM, Noman Amir Jamil wrote:

> Hi All,
> 
> I was wondering if it is possible to include a conditional check in task 
> definition. For example, I have a task defined:
> 
> 
> task :check_tomcat6_status, :roles => :app do 
>     sudo "/sbin/service tomcat6 status"
>     run "sleep 15s"
> end
> 
> 
> I want to introduce a conditional hosts check in it, like:
> 
> if :hosts = host1 then
>    sudo "/sbin/service tomcat5 status"
> else
>   sudo "/sbin/service tomcat6 status"
> fi
>  run "sleep 15s"
> end
> 
> 
> Can someone help me with the correct syntax for this scenario?
> 
> Thanks
> Noman A.
> 
> -- 
> * You received this message because you are subscribed to the Google Groups 
> "Capistrano" group.
> * To post to this group, send email to [email protected] 
> (mailto:[email protected])
> * To unsubscribe from this group, send email to 
> [email protected] 
> (mailto:[email protected]) For more options, visit this 
> group at http://groups.google.com/group/capistrano?hl=en 

-- 
* You received this message because you are subscribed to the Google Groups 
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to 
[email protected] For more options, visit this group at 
http://groups.google.com/group/capistrano?hl=en

Reply via email to