Fabric has other useful features, such as roles and context managers.
Fabric can define roles for hosts, and run only the tasks to role members. For example, we might have a bunch of database servers on which we need to validate whether the MySql service is up, and other web servers on which we need to validate whether the Apache service is up. We can group these hosts into roles, and execute functions based on those roles:
__author__ = "Bassim Aly"
__EMAIL__ = "[email protected]"
from fabric.api import *
env.hosts = [
'10.10.10.140', # ubuntu machine
'10.10.10.193', # CentOS machine