I'm currently trying to automate a deployment process, involving 3 different machines :
- userA@hostA, pwdA
- userB@hostB, pwdB
- userC@hostC, pwdC
Here's the scenario I would like to execute, using Python's Fabric library (to which I'm new) :
def deploy():
execute(taskA, hosts=[hostA])
execute(taskB, hosts=[hostB])
execute(taskC, hosts=[hostC])
I've tried to set the variable env.passwords
like this:
env.passwords = {'userA@hostA:22':pwdA, 'userB@hostB:22':pwdB, 'userC@hostC:22':pwdC}
But it makes the SSH connection hanging.
My current workaround is to modify the variables env.user
and env.password
before each call to execute
(I could also do that at the beginning of taskA, taskB and taskC). I really do not find that very elegant, and totally outside of Fabric's spirit.
If someone has ran into such situation, found him/herself with a hanging SSH connection while trying to use the env.passwords
dict, I'm all yours ! And of course, if anyone already managed to make a more elegant multi-host-password handling, I would be glad to hear about any hint.