This is a very Fabric specific question, but more experienced python hackers might be able to answer this, even if they don\'t know Fabric.
I am trying to specify differ
I didn't test it, but might work:
def _get_current_role(): for role in env.roledefs.keys(): if env.host_string in env.roledefs[role]: return role return None