-
Notifications
You must be signed in to change notification settings - Fork 152
Run ParallelSSHClient on 8 servers. One server is having port 422. All other servers on port 22 #361
-
I want to execute ParallelSSHClient on 8 servers. One server is having port 422. All other servers on port 22.
How to achieve this? If possible example please.
Beta Was this translation helpful? Give feedback.
All reactions
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
-
We have stored the IP address in PostgreSQL database. How to store the HostConfig data in PostgreSQL.
Beta Was this translation helpful? Give feedback.
All reactions
-
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(),
]
Overrides port to 422 for only the first host. Second host gets ParallelSSHClient
configuration.
Storing HostConfig
data elsewhere is out of scope for the library. There are many ways to do that, up to developers.
The library uses HostConfig
entries for per-host configuration. How/where/if they are stored is up to developers.
Beta Was this translation helpful? Give feedback.