Hi everyone! This is my first post on this mailing list, so please
excuse me if I don't follow some rule or convention of yours.
My name is Francisco and I started using Fabric a couple weeks ago, and
so far I'm happy with what I've seen.
Nevertheless, there always comes a time when even the best tool fails to
accomplish some task, and that's why I'm here.
The thing is, I have two different ways to group my hosts: one is by
role (master or slave), the other is by staging or production, i.e.
there is a master and many slaves in staging, and another master and
many slaves in production.
I have tasks that I need to run only on the master and others to run in
the slaves. Also, I want to be able to run tasks only on staging or only
on production.
The way I've been handling this is by having two different roledefs, one
for master hosts and another for slaves. Each roledef has two roles,
staging and production, meaning I can do something like "fab deploy -R
staging" and this makes sure I won't be installing things into
production by mistake.
These roledefs are defined in a settings file and each fabfile of mine
imports one of them and sets env.roledefs to it.
This works as long as all the tasks in each file are to be executed in
hosts with the same role, either master or slaves. And so far that's
what happened naturally.
Now I have a fabfile which has some tasks that should run in the master
host and another task that should run in the slaves, but I have no way
of saying to fabric "please use a different roledef for this task",
since by the time my code inside the task starts to execute, the
roledefs have already been processed.
Is there any way around this which does not require me to separate the
tasks in two different files?
Francisco Vieira
P.S: Sorry for the such a big post for such a trivial matter...
_______________________________________________
Fab-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/fab-user