[Answered ]-Python Fabric + multiple host configuration in database

2👍

That’s not hard to do. In your fabfile, initialize the env object with credentials from the database:

from fabric.api import *

credentials = load_credentials_from_your_db()
for (hostname, username, password) in credentials:
    host_string = username + '@' + hostname
    env.hosts.append(host_string)
    env.passwords[host_string] = password

It’s untested, but the docs say it should work.

👤Simon

Leave a comment