[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] Running commands on multiple servers in a command

From: Peter Sheats
Subject: Re: [Fab-user] Running commands on multiple servers in a command
Date: Thu, 14 May 2009 16:10:48 -0400

ok, yes version .9.

My temporary fix is to use run('ssh server2 command to run') which works fine.

I will try your solution some time as well.

Thanks, and keep up the good work.


On Thu, May 14, 2009 at 4:06 PM, Jeff Forcier <address@hidden> wrote:
On Thu, May 14, 2009 at 9:46 AM, Peter Sheats <address@hidden> wrote:
> Maybe this is possible but I'm not understanding how to do this.
> Server 1 is the webserver
> Server 2 is the media server
> My deployment strategy requires doing something on both to deploy.  However,
> what i do on Server 2 is dependent on information I find from Server 1.
> I want to run 'fab live deploy' and do the following:
> def deploy():
>     run("stuff on server1")
>     value = run("value based on info from Server 1")
>     # now, based on value from server 1
>     run("commands on server2")
>     #whole project successfully deployed now
> Am I not understanding something or is this use-case not supported?

I assume you're referring to 0.9, correct me if I'm wrong :)

The default execution model is simply "obtain host list for given task
function, run function once per host". I wrote down some ideas in the
project's TODO list for ways to update this, since I definitely want
things to be more flexible in this area.

However, all that really matters to run() or sudo() is that
env.host_string is defined, so you can currently do something like
this (ensuring not to set the host list on the command line or in your

def deploy():
   env.host_string = 'server1'
   run("stuff on server1"
   value = run("/get/my/value --please")
   env.host_string = 'server2'
   run("stuff on server2")

While I haven't explicitly tested this exact usage out, it *should* work.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]