[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fab-user] Diferent commands on diferent hosts
From: |
Jordi Funollet |
Subject: |
[Fab-user] Diferent commands on diferent hosts |
Date: |
Sun, 23 Nov 2008 15:11:39 +0100 |
User-agent: |
KMail/1.10.3 (Linux/2.6.27-7-generic; KDE/4.1.3; i686; ; ) |
Some frequents tasks require running some commands on specific hosts (not on
every host). An easy example could be migrating a database or deploying
different parts of the application on different hosts.
My first idea was changing the value of 'fab_hosts' as needed, but as far as I
understand 'fab_hosts' is populated only the first time. So with this fabfile,
def hostname():
set( fab_hosts = ['webserver',] )
run("hostname")
def hostname_full():
set( fab_hosts = ['dbserver',] )
run("hostname -f")
...this would return the name of both hosts:
$ fab hostname ; fab hostname_full
...but this will return the name of 'webserver', just twice:
$ fab hostname hostname_full
Did someone find a way to do this in a single step? I mean, invoking fabric
just once. Some processes like migrating a database to another host are far
easier to implement if I can build an atomic script ("dumping the database on
host A failed, don't try to upload it to host B").
I'm on fabric-0.0.9 (via Pypi). I suspect my question is related with the
Capistrano-like roles feature that's been discussed before, but I'm not sure
what the plans are about it.
--
##############################
### Jordi Funollet
### http://www.terraquis.net
- [Fab-user] Diferent commands on diferent hosts,
Jordi Funollet <=