The syntax for the run operation in Fabric is as follows:
run(command, shell=True, pty=True, combine_stderr=True, quiet=False, warn_only=False, stdout=None, stderr=None)
This will execute the command on a remote host, while the shell argument controls whether a shell (such as /bin/sh) should be created before execution (the same parameter also exists in the sub-process).
After the command execution, Fabric will populate .succeeded or .failed, depending on the command output. You can check whether the command succeeded or failed by calling the following:
def run_ops(): output = run("hostname")