Reputation: 30
I am trying to do parallel SSH using ParallelSSHClient.
When I run as hosts = ['x.x.x.x', 'y.y.y.y'] ParallelSSHClient (hosts, 'user', 'pass') It is working fine. But what if the username and password varies for x.x.x.x and y.y.y.y? I have to pass username and password also as list right. But if I pass , it is not working.
Upvotes: 0
Views: 1227
Reputation: 101
Per documentation of parallel SSH:
from pssh.config import HostConfig
hosts = ['localhost', 'localhost']
host_config = [
HostConfig(port=2222, user='user1',
password='pass', private_key='my_pkey.pem'),
HostConfig(port=2223, user='user2',
password='pass', private_key='my_other_key.pem'),
]
client = ParallelSSHClient(hosts, host_config=host_config)
client.run_command('uname')
Upvotes: 0