Skip to content

Run ParallelSSHClient on 8 servers. One server is having port 422. All other servers on port 22 #361

Answered by pkittenis
sreenik250 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi there,

Have a look at per-host configuration documentation.

from pssh.config import HostConfig

hosts = ['localhost', 'localhost']
host_config = [
    HostConfig(port=422, user='user1',
               password='pass', private_key='my_pkey.pem'),
    HostConfig(user='user2',
               password='pass', private_key='my_other_key.pem'),
]

client = ParallelSSHClient(hosts, host_config=host_config)
client.run_command('uname')
<..>

Port can be omitted from HostConfig unless it's a non-default port. Default port is 22. If there is no need to override any configuration for a server an empty HostConfig may be used, eg:

host_config = [
    HostConfig(port=422),
    HostConfig(),
]

Overrid…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pkittenis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants