If you want a task to be executed on all roles, just leave the :roles  
part off of the task declaration. The default setting is for the task  
to be executed everywhere.

- Jamis

On Mar 16, 2007, at 1:36 PM, rcreasey wrote:

>
> Well, I can appreciate that each Task has its own server scope, but I
> was looking for a more generic way to just classify a Task for all
> servers, regardless of role.  In fact, I have such a homogeneous
> environment, I didn't want to classify systems into roles.  I merely
> wanted to express that a task was applicable to all servers,
> regardless of role (or absence of one, for that matter).
>
> On Mar 15, 8:09 pm, Jamis Buck <[EMAIL PROTECTED]> wrote:
>> The problem is that the task in question has no explicit :roles
>> setting, and so is invoked on all servers. Note that each task has
>> its own server scope--the server scope is not inherited from the
>> calling task.
>>
>> The solution is to put the appropriate :roles setting on the
>> stop_default_apache task.
>>
>> - Jamis
>>
>> On Mar 15, 2007, at 11:07 AM, The Zed wrote:
>>
>>
>>
>>> Hello,
>>
>>> I must be overlooking something because I do not understand cap's
>>> behaviour. The problem seems simple:
>>
>>> why is the task stop_default_apache called for storage roles?
>>
>>> To present my problem here, I simplified my context to the  
>>> following:
>>
>>> role :app, "10.0.0.14"
>>> role :app, "10.0.0.15"
>>> role :static, "10.0.0.14"
>>> role :storage, "10.0.0.45"               # st015
>>> role :storage, "10.0.0.46"               # st016
>>
>>> task :after_setup do
>>>   after_setup_common
>>>   after_setup_app
>>>   after_setup_storage
>>>   after_setup_static
>>> end
>>
>>> task :after_setup_storage, :roles => :storage do
>>> end
>>
>>> task :after_setup_app, :roles => :app do
>>>   stop_default_apache
>>> end
>>
>>> task :after_setup_static, :roles => :static do
>>>   stop_default_apache
>>> end
>>
>>> task :stop_default_apache do
>>>   run 'echo "Stopping apache on $HOSTNAME"'
>>>   sudo "httpd -k stop"
>>> end
>>
>>> Here is the relevant part of the output:
>>
>>>   * executing task after_setup
>>>   * executing task after_setup_common
>>>   * executing task install_ssh_key
>>>   * executing task after_setup_app
>>>   * executing task stop_default_apache
>>>   * executing "echo \"Stopping apache on $HOSTNAME\""
>>>     servers: ["10.0.0.14", "10.0.0.15", "10.0.0.45", "10.0.0.46"]
>>>     [10.0.0.14] executing command
>>>     [10.0.0.45] executing command
>>>     [10.0.0.46] executing command
>>>  ** [out :: 10.0.0.14] Stopping apache on wb004
>>>  ** [out :: 10.0.0.45] Stopping apache on st015
>>>     [10.0.0.15] executing command
>>>  ** [out :: 10.0.0.46] Stopping apache on st016
>>>  ** [out :: 10.0.0.15] Stopping apache on wb005
>>>     command finished
>>
>>> I am puzzled, could anyone explain this ?
>>
>>> -- Arnaud.
>>
>>> P.S.
>>
>>> $ cap -V
>>> /usr/bin/cap:17:Warning: require_gem is obsolete.  Use gem instead.
>>> Capistrano v1.4.1
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to