When I define a task to run on several remote servers, if the task runs on server one and exits with an error, Fabric will stop and abort the task. But I want to make fabric
You should set the abort_exception environment variable and catch the exception.
For example:
from fabric.api import env
from fabric.operations import sudo
class FabricException(Exception):
pass
env.abort_exception = FabricException
# ... set up the rest of the environment...
try:
sudo('reboot')
except FabricException:
pass # This is expected, we can continue.
You can also set it in a with block. See the documentation here.