Fabric密码保存

参考:https://segmentfault.com/a/1190000000497630

多个IP分别使用不同的账号、密码

from fabric.api import *
env.hosts = [
    'user@192.168.1.1',
    'user@192.168.1.2',
]

env.passwords = {
    'user@192.168.1.1:22': 'password1',
    'user@192.168.1.2:22': 'password2',
}

@task
def hello():
    run('echo "hello,world"')

多个IP使用相同的密码:

env.user = 'username'
env.password = 'pass'
env.hosts = ['192.168.1.1', '192.168.1.2', '192.168.1.3']
env.hosts=['root@192.168.1.1','root@192.168.1.2']
env.password='password'
原文地址:https://www.cnblogs.com/dreamer-fish/p/5784846.html