For at udvide svaret med et stof-eksempel...
# In fabfile.py
def create_database():
"""Creates role and database"""
db_user = get_user() # define these
db_pass = get_pass()
db_name = get_db_name()
sudo('psql -c "CREATE USER %s WITH NOCREATEDB NOCREATEUSER " \
"ENCRYPTED PASSWORD E\'%s\'"' % (db_user, db_pass), user='postgres')
sudo('psql -c "CREATE DATABASE %s WITH OWNER %s"' % (
db_name, db_user), user='postgres')