multiSSH3 4.81__tar.gz → 4.89__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of multiSSH3 might be problematic. Click here for more details.
- {multissh3-4.81 → multissh3-4.89}/PKG-INFO +31 -51
- {multissh3-4.81 → multissh3-4.89}/README.md +30 -50
- {multissh3-4.81 → multissh3-4.89}/multiSSH3.egg-info/PKG-INFO +31 -51
- {multissh3-4.81 → multissh3-4.89}/multiSSH3.py +292 -176
- {multissh3-4.81 → multissh3-4.89}/setup.py +1 -1
- {multissh3-4.81 → multissh3-4.89}/LICENSE +0 -0
- {multissh3-4.81 → multissh3-4.89}/multiSSH3.egg-info/SOURCES.txt +0 -0
- {multissh3-4.81 → multissh3-4.89}/multiSSH3.egg-info/dependency_links.txt +0 -0
- {multissh3-4.81 → multissh3-4.89}/multiSSH3.egg-info/entry_points.txt +0 -0
- {multissh3-4.81 → multissh3-4.89}/multiSSH3.egg-info/requires.txt +0 -0
- {multissh3-4.81 → multissh3-4.89}/multiSSH3.egg-info/top_level.txt +0 -0
- {multissh3-4.81 → multissh3-4.89}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: multiSSH3
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.89
|
|
4
4
|
Summary: Run commands on multiple hosts via SSH
|
|
5
5
|
Home-page: https://github.com/yufei-pan/multiSSH3
|
|
6
6
|
Author: Yufei Pan
|
|
@@ -20,12 +20,12 @@ Can be used in bash scripts for automation actions.
|
|
|
20
20
|
Also able to be imported and / or use with Flexec SSH Backend to perform cluster automation actions.
|
|
21
21
|
|
|
22
22
|
Install via
|
|
23
|
-
```
|
|
23
|
+
```bash
|
|
24
24
|
pip install multiSSH3
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
multiSSH3 will be available as
|
|
28
|
-
```
|
|
28
|
+
```bash
|
|
29
29
|
mssh
|
|
30
30
|
mssh3
|
|
31
31
|
multissh
|
|
@@ -37,7 +37,7 @@ multissh will read a config file located at ```/etc/multiSSH3.config.json```
|
|
|
37
37
|
|
|
38
38
|
To store / generate a config file with the current command line options, you can use
|
|
39
39
|
|
|
40
|
-
```
|
|
40
|
+
```bash
|
|
41
41
|
mssh --generate_default_config_file
|
|
42
42
|
```
|
|
43
43
|
|
|
@@ -49,42 +49,52 @@ If you want to store password, it will be a plain text password in this config f
|
|
|
49
49
|
|
|
50
50
|
This option can also be used to store cli options into the config files. For example.
|
|
51
51
|
|
|
52
|
-
```
|
|
52
|
+
```bash
|
|
53
53
|
mssh --ipmi_interface_ip_prefix 192 --generate_default_config_file
|
|
54
54
|
```
|
|
55
55
|
will store
|
|
56
|
-
```
|
|
56
|
+
```json
|
|
57
57
|
"DEFAULT_IPMI_INTERFACE_IP_PREFIX": "192"
|
|
58
58
|
```
|
|
59
59
|
into the json file.
|
|
60
60
|
|
|
61
61
|
By defualt reads bash env variables for hostname aliases. Also able to read
|
|
62
|
-
```
|
|
62
|
+
```bash
|
|
63
63
|
DEFAULT_ENV_FILE = '/etc/profile.d/hosts.sh'
|
|
64
64
|
```
|
|
65
65
|
as hostname aliases.
|
|
66
66
|
|
|
67
67
|
For example:
|
|
68
|
-
```
|
|
68
|
+
```bash
|
|
69
69
|
export all='192.168.1-2.1-64'
|
|
70
70
|
mssh all 'echo hi'
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
Note: you probably want to set presistent ssh connections to speed up each connection events.
|
|
74
|
+
An example .ssh/config:
|
|
75
|
+
```bash
|
|
76
|
+
Host *
|
|
77
|
+
StrictHostKeyChecking no
|
|
78
|
+
ControlMaster auto
|
|
79
|
+
ControlPath /run/ssh_sockets_%r@%h-%p
|
|
80
|
+
ControlPersist 3600
|
|
81
|
+
```
|
|
82
|
+
|
|
73
83
|
It is also able to recognize ip blocks / number blocks / hex blocks / character blocks directly.
|
|
74
84
|
|
|
75
85
|
For example:
|
|
76
|
-
```
|
|
86
|
+
```bash
|
|
77
87
|
mssh testrig[1-10] lsblk
|
|
78
88
|
mssh ww[a-c],10.100.0.* 'cat /etc/fstab' 'sed -i "/lustre/d' /etc/fstab' 'cat /etc/fstab'
|
|
79
89
|
```
|
|
80
90
|
|
|
81
91
|
It also supports interactive inputs. ( and able to async boardcast to all supplied hosts )
|
|
82
|
-
```
|
|
92
|
+
```bash
|
|
83
93
|
mssh www bash
|
|
84
94
|
```
|
|
85
95
|
|
|
86
96
|
By default, it will try to fit everything inside your window.
|
|
87
|
-
```
|
|
97
|
+
```bash
|
|
88
98
|
DEFAULT_CURSES_MINIMUM_CHAR_LEN = 40
|
|
89
99
|
DEFAULT_CURSES_MINIMUM_LINE_LEN = 1
|
|
90
100
|
```
|
|
@@ -93,7 +103,7 @@ While leaving minimum 40 characters / 1 line for each host display by default. Y
|
|
|
93
103
|
|
|
94
104
|
Use ```mssh --help``` for more info.
|
|
95
105
|
|
|
96
|
-
```
|
|
106
|
+
```bash
|
|
97
107
|
usage: mssh [-h] [-u USERNAME] [-ea EXTRAARGS] [-p PASSWORD] [-11] [-f FILE] [--file_sync] [--scp] [-t TIMEOUT] [-r REPEAT] [-i INTERVAL] [--ipmi]
|
|
98
108
|
[-pre INTERFACE_IP_PREFIX] [-q] [-ww WINDOW_WIDTH] [-wh WINDOW_HEIGHT] [-sw] [-eo] [-no] [--no_env] [--env_file ENV_FILE] [-m MAXCONNECTIONS] [-j]
|
|
99
109
|
[--success_hosts] [-g] [-nw] [-su] [-sh SKIPHOSTS] [-V]
|
|
@@ -164,8 +174,6 @@ Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
|
|
|
164
174
|
- [multissh](#multissh)
|
|
165
175
|
- [Table of Contents](#table-of-contents)
|
|
166
176
|
- [Features](#features)
|
|
167
|
-
- [Installation](#installation)
|
|
168
|
-
- [Usage](#usage)
|
|
169
177
|
- [Basic Syntax](#basic-syntax)
|
|
170
178
|
- [Command-Line Options](#command-line-options)
|
|
171
179
|
- [Examples](#examples)
|
|
@@ -194,36 +202,10 @@ Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
|
|
|
194
202
|
- **Interactive Mode**: Run interactive commands with curses-based UI for monitoring.
|
|
195
203
|
- **Quiet Mode**: Suppress output for cleaner automation scripts.
|
|
196
204
|
|
|
197
|
-
## Installation
|
|
198
|
-
|
|
199
|
-
1. **Clone the Repository**
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
git clone https://github.com/yourusername/multissh.git
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
2. **Navigate to the Directory**
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
cd multissh
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
3. **Make the Script Executable**
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
chmod +x multissh.py
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
4. **Install Dependencies**
|
|
218
|
-
|
|
219
|
-
Ensure you have Python 3 and the required modules installed. You may need to install `curses` and `ipaddress` modules if they are not already available.
|
|
220
|
-
|
|
221
|
-
## Usage
|
|
222
|
-
|
|
223
205
|
### Basic Syntax
|
|
224
206
|
|
|
225
207
|
```bash
|
|
226
|
-
|
|
208
|
+
mssh [options] <hosts> <commands>
|
|
227
209
|
```
|
|
228
210
|
|
|
229
211
|
- `<hosts>`: Comma-separated list of target hosts. Supports ranges and wildcards.
|
|
@@ -267,7 +249,7 @@ Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
|
|
|
267
249
|
### Running a Command on Multiple Hosts
|
|
268
250
|
|
|
269
251
|
```bash
|
|
270
|
-
|
|
252
|
+
mssh "host1,host2,host3" "uptime"
|
|
271
253
|
```
|
|
272
254
|
|
|
273
255
|
This command runs `uptime` on `host1`, `host2`, and `host3`.
|
|
@@ -275,7 +257,7 @@ This command runs `uptime` on `host1`, `host2`, and `host3`.
|
|
|
275
257
|
### Copying Files to Multiple Hosts
|
|
276
258
|
|
|
277
259
|
```bash
|
|
278
|
-
|
|
260
|
+
mssh -f "/path/to/local/file.txt" "host1,host2,host3" "/remote/path/"
|
|
279
261
|
```
|
|
280
262
|
|
|
281
263
|
This command copies `file.txt` to `/remote/path/` on the specified hosts.
|
|
@@ -283,7 +265,7 @@ This command copies `file.txt` to `/remote/path/` on the specified hosts.
|
|
|
283
265
|
### Using Hostname Ranges
|
|
284
266
|
|
|
285
267
|
```bash
|
|
286
|
-
|
|
268
|
+
mssh "host[01-05]" "hostname"
|
|
287
269
|
```
|
|
288
270
|
|
|
289
271
|
This expands to `host01`, `host02`, `host03`, `host04`, `host05` and runs `hostname` on each.
|
|
@@ -291,7 +273,7 @@ This expands to `host01`, `host02`, `host03`, `host04`, `host05` and runs `hostn
|
|
|
291
273
|
### Using IPMI
|
|
292
274
|
|
|
293
275
|
```bash
|
|
294
|
-
|
|
276
|
+
mssh --ipmi "192.168.1.[100-105]" "chassis power status"
|
|
295
277
|
```
|
|
296
278
|
|
|
297
279
|
Runs `ipmitool chassis power status` on the specified IPMI interfaces.
|
|
@@ -299,7 +281,7 @@ Runs `ipmitool chassis power status` on the specified IPMI interfaces.
|
|
|
299
281
|
### Using Password Authentication
|
|
300
282
|
|
|
301
283
|
```bash
|
|
302
|
-
|
|
284
|
+
mssh -p "yourpassword" "host1,host2" "whoami"
|
|
303
285
|
```
|
|
304
286
|
|
|
305
287
|
Uses `sshpass` to provide the password for SSH authentication.
|
|
@@ -307,7 +289,7 @@ Uses `sshpass` to provide the password for SSH authentication.
|
|
|
307
289
|
### Skipping Unreachable Hosts
|
|
308
290
|
|
|
309
291
|
```bash
|
|
310
|
-
|
|
292
|
+
mssh -su "host1,host2,host3" "date"
|
|
311
293
|
```
|
|
312
294
|
|
|
313
295
|
Skips hosts that are unreachable during execution.
|
|
@@ -315,7 +297,7 @@ Skips hosts that are unreachable during execution.
|
|
|
315
297
|
### JSON Output
|
|
316
298
|
|
|
317
299
|
```bash
|
|
318
|
-
|
|
300
|
+
mssh -j "host1,host2" "uname -a"
|
|
319
301
|
```
|
|
320
302
|
|
|
321
303
|
Outputs the results in JSON format, suitable for parsing.
|
|
@@ -323,7 +305,7 @@ Outputs the results in JSON format, suitable for parsing.
|
|
|
323
305
|
### Quiet Mode
|
|
324
306
|
|
|
325
307
|
```bash
|
|
326
|
-
|
|
308
|
+
mssh -q "host1,host2" "ls /nonexistent"
|
|
327
309
|
```
|
|
328
310
|
|
|
329
311
|
Suppresses all output, useful for scripts where you only care about exit codes.
|
|
@@ -335,8 +317,6 @@ Suppresses all output, useful for scripts where you only care about exit codes.
|
|
|
335
317
|
- Use `--no_env` to prevent loading any environment variables from files.
|
|
336
318
|
|
|
337
319
|
## Notes
|
|
338
|
-
|
|
339
|
-
- **SSH Configuration**: The script modifies `~/.ssh/config` to disable `StrictHostKeyChecking`. Ensure this is acceptable in your environment.
|
|
340
320
|
- **Dependencies**: Requires Python 3, `sshpass` (if using password authentication), and standard Unix utilities like `ssh`, `scp`, and `rsync`.
|
|
341
321
|
- **Signal Handling**: Supports graceful termination with `Ctrl+C`.
|
|
342
322
|
|
|
@@ -4,12 +4,12 @@ Can be used in bash scripts for automation actions.
|
|
|
4
4
|
Also able to be imported and / or use with Flexec SSH Backend to perform cluster automation actions.
|
|
5
5
|
|
|
6
6
|
Install via
|
|
7
|
-
```
|
|
7
|
+
```bash
|
|
8
8
|
pip install multiSSH3
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
multiSSH3 will be available as
|
|
12
|
-
```
|
|
12
|
+
```bash
|
|
13
13
|
mssh
|
|
14
14
|
mssh3
|
|
15
15
|
multissh
|
|
@@ -21,7 +21,7 @@ multissh will read a config file located at ```/etc/multiSSH3.config.json```
|
|
|
21
21
|
|
|
22
22
|
To store / generate a config file with the current command line options, you can use
|
|
23
23
|
|
|
24
|
-
```
|
|
24
|
+
```bash
|
|
25
25
|
mssh --generate_default_config_file
|
|
26
26
|
```
|
|
27
27
|
|
|
@@ -33,42 +33,52 @@ If you want to store password, it will be a plain text password in this config f
|
|
|
33
33
|
|
|
34
34
|
This option can also be used to store cli options into the config files. For example.
|
|
35
35
|
|
|
36
|
-
```
|
|
36
|
+
```bash
|
|
37
37
|
mssh --ipmi_interface_ip_prefix 192 --generate_default_config_file
|
|
38
38
|
```
|
|
39
39
|
will store
|
|
40
|
-
```
|
|
40
|
+
```json
|
|
41
41
|
"DEFAULT_IPMI_INTERFACE_IP_PREFIX": "192"
|
|
42
42
|
```
|
|
43
43
|
into the json file.
|
|
44
44
|
|
|
45
45
|
By defualt reads bash env variables for hostname aliases. Also able to read
|
|
46
|
-
```
|
|
46
|
+
```bash
|
|
47
47
|
DEFAULT_ENV_FILE = '/etc/profile.d/hosts.sh'
|
|
48
48
|
```
|
|
49
49
|
as hostname aliases.
|
|
50
50
|
|
|
51
51
|
For example:
|
|
52
|
-
```
|
|
52
|
+
```bash
|
|
53
53
|
export all='192.168.1-2.1-64'
|
|
54
54
|
mssh all 'echo hi'
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
Note: you probably want to set presistent ssh connections to speed up each connection events.
|
|
58
|
+
An example .ssh/config:
|
|
59
|
+
```bash
|
|
60
|
+
Host *
|
|
61
|
+
StrictHostKeyChecking no
|
|
62
|
+
ControlMaster auto
|
|
63
|
+
ControlPath /run/ssh_sockets_%r@%h-%p
|
|
64
|
+
ControlPersist 3600
|
|
65
|
+
```
|
|
66
|
+
|
|
57
67
|
It is also able to recognize ip blocks / number blocks / hex blocks / character blocks directly.
|
|
58
68
|
|
|
59
69
|
For example:
|
|
60
|
-
```
|
|
70
|
+
```bash
|
|
61
71
|
mssh testrig[1-10] lsblk
|
|
62
72
|
mssh ww[a-c],10.100.0.* 'cat /etc/fstab' 'sed -i "/lustre/d' /etc/fstab' 'cat /etc/fstab'
|
|
63
73
|
```
|
|
64
74
|
|
|
65
75
|
It also supports interactive inputs. ( and able to async boardcast to all supplied hosts )
|
|
66
|
-
```
|
|
76
|
+
```bash
|
|
67
77
|
mssh www bash
|
|
68
78
|
```
|
|
69
79
|
|
|
70
80
|
By default, it will try to fit everything inside your window.
|
|
71
|
-
```
|
|
81
|
+
```bash
|
|
72
82
|
DEFAULT_CURSES_MINIMUM_CHAR_LEN = 40
|
|
73
83
|
DEFAULT_CURSES_MINIMUM_LINE_LEN = 1
|
|
74
84
|
```
|
|
@@ -77,7 +87,7 @@ While leaving minimum 40 characters / 1 line for each host display by default. Y
|
|
|
77
87
|
|
|
78
88
|
Use ```mssh --help``` for more info.
|
|
79
89
|
|
|
80
|
-
```
|
|
90
|
+
```bash
|
|
81
91
|
usage: mssh [-h] [-u USERNAME] [-ea EXTRAARGS] [-p PASSWORD] [-11] [-f FILE] [--file_sync] [--scp] [-t TIMEOUT] [-r REPEAT] [-i INTERVAL] [--ipmi]
|
|
82
92
|
[-pre INTERFACE_IP_PREFIX] [-q] [-ww WINDOW_WIDTH] [-wh WINDOW_HEIGHT] [-sw] [-eo] [-no] [--no_env] [--env_file ENV_FILE] [-m MAXCONNECTIONS] [-j]
|
|
83
93
|
[--success_hosts] [-g] [-nw] [-su] [-sh SKIPHOSTS] [-V]
|
|
@@ -148,8 +158,6 @@ Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
|
|
|
148
158
|
- [multissh](#multissh)
|
|
149
159
|
- [Table of Contents](#table-of-contents)
|
|
150
160
|
- [Features](#features)
|
|
151
|
-
- [Installation](#installation)
|
|
152
|
-
- [Usage](#usage)
|
|
153
161
|
- [Basic Syntax](#basic-syntax)
|
|
154
162
|
- [Command-Line Options](#command-line-options)
|
|
155
163
|
- [Examples](#examples)
|
|
@@ -178,36 +186,10 @@ Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
|
|
|
178
186
|
- **Interactive Mode**: Run interactive commands with curses-based UI for monitoring.
|
|
179
187
|
- **Quiet Mode**: Suppress output for cleaner automation scripts.
|
|
180
188
|
|
|
181
|
-
## Installation
|
|
182
|
-
|
|
183
|
-
1. **Clone the Repository**
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
git clone https://github.com/yourusername/multissh.git
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
2. **Navigate to the Directory**
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
cd multissh
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
3. **Make the Script Executable**
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
chmod +x multissh.py
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
4. **Install Dependencies**
|
|
202
|
-
|
|
203
|
-
Ensure you have Python 3 and the required modules installed. You may need to install `curses` and `ipaddress` modules if they are not already available.
|
|
204
|
-
|
|
205
|
-
## Usage
|
|
206
|
-
|
|
207
189
|
### Basic Syntax
|
|
208
190
|
|
|
209
191
|
```bash
|
|
210
|
-
|
|
192
|
+
mssh [options] <hosts> <commands>
|
|
211
193
|
```
|
|
212
194
|
|
|
213
195
|
- `<hosts>`: Comma-separated list of target hosts. Supports ranges and wildcards.
|
|
@@ -251,7 +233,7 @@ Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
|
|
|
251
233
|
### Running a Command on Multiple Hosts
|
|
252
234
|
|
|
253
235
|
```bash
|
|
254
|
-
|
|
236
|
+
mssh "host1,host2,host3" "uptime"
|
|
255
237
|
```
|
|
256
238
|
|
|
257
239
|
This command runs `uptime` on `host1`, `host2`, and `host3`.
|
|
@@ -259,7 +241,7 @@ This command runs `uptime` on `host1`, `host2`, and `host3`.
|
|
|
259
241
|
### Copying Files to Multiple Hosts
|
|
260
242
|
|
|
261
243
|
```bash
|
|
262
|
-
|
|
244
|
+
mssh -f "/path/to/local/file.txt" "host1,host2,host3" "/remote/path/"
|
|
263
245
|
```
|
|
264
246
|
|
|
265
247
|
This command copies `file.txt` to `/remote/path/` on the specified hosts.
|
|
@@ -267,7 +249,7 @@ This command copies `file.txt` to `/remote/path/` on the specified hosts.
|
|
|
267
249
|
### Using Hostname Ranges
|
|
268
250
|
|
|
269
251
|
```bash
|
|
270
|
-
|
|
252
|
+
mssh "host[01-05]" "hostname"
|
|
271
253
|
```
|
|
272
254
|
|
|
273
255
|
This expands to `host01`, `host02`, `host03`, `host04`, `host05` and runs `hostname` on each.
|
|
@@ -275,7 +257,7 @@ This expands to `host01`, `host02`, `host03`, `host04`, `host05` and runs `hostn
|
|
|
275
257
|
### Using IPMI
|
|
276
258
|
|
|
277
259
|
```bash
|
|
278
|
-
|
|
260
|
+
mssh --ipmi "192.168.1.[100-105]" "chassis power status"
|
|
279
261
|
```
|
|
280
262
|
|
|
281
263
|
Runs `ipmitool chassis power status` on the specified IPMI interfaces.
|
|
@@ -283,7 +265,7 @@ Runs `ipmitool chassis power status` on the specified IPMI interfaces.
|
|
|
283
265
|
### Using Password Authentication
|
|
284
266
|
|
|
285
267
|
```bash
|
|
286
|
-
|
|
268
|
+
mssh -p "yourpassword" "host1,host2" "whoami"
|
|
287
269
|
```
|
|
288
270
|
|
|
289
271
|
Uses `sshpass` to provide the password for SSH authentication.
|
|
@@ -291,7 +273,7 @@ Uses `sshpass` to provide the password for SSH authentication.
|
|
|
291
273
|
### Skipping Unreachable Hosts
|
|
292
274
|
|
|
293
275
|
```bash
|
|
294
|
-
|
|
276
|
+
mssh -su "host1,host2,host3" "date"
|
|
295
277
|
```
|
|
296
278
|
|
|
297
279
|
Skips hosts that are unreachable during execution.
|
|
@@ -299,7 +281,7 @@ Skips hosts that are unreachable during execution.
|
|
|
299
281
|
### JSON Output
|
|
300
282
|
|
|
301
283
|
```bash
|
|
302
|
-
|
|
284
|
+
mssh -j "host1,host2" "uname -a"
|
|
303
285
|
```
|
|
304
286
|
|
|
305
287
|
Outputs the results in JSON format, suitable for parsing.
|
|
@@ -307,7 +289,7 @@ Outputs the results in JSON format, suitable for parsing.
|
|
|
307
289
|
### Quiet Mode
|
|
308
290
|
|
|
309
291
|
```bash
|
|
310
|
-
|
|
292
|
+
mssh -q "host1,host2" "ls /nonexistent"
|
|
311
293
|
```
|
|
312
294
|
|
|
313
295
|
Suppresses all output, useful for scripts where you only care about exit codes.
|
|
@@ -319,8 +301,6 @@ Suppresses all output, useful for scripts where you only care about exit codes.
|
|
|
319
301
|
- Use `--no_env` to prevent loading any environment variables from files.
|
|
320
302
|
|
|
321
303
|
## Notes
|
|
322
|
-
|
|
323
|
-
- **SSH Configuration**: The script modifies `~/.ssh/config` to disable `StrictHostKeyChecking`. Ensure this is acceptable in your environment.
|
|
324
304
|
- **Dependencies**: Requires Python 3, `sshpass` (if using password authentication), and standard Unix utilities like `ssh`, `scp`, and `rsync`.
|
|
325
305
|
- **Signal Handling**: Supports graceful termination with `Ctrl+C`.
|
|
326
306
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: multiSSH3
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.89
|
|
4
4
|
Summary: Run commands on multiple hosts via SSH
|
|
5
5
|
Home-page: https://github.com/yufei-pan/multiSSH3
|
|
6
6
|
Author: Yufei Pan
|
|
@@ -20,12 +20,12 @@ Can be used in bash scripts for automation actions.
|
|
|
20
20
|
Also able to be imported and / or use with Flexec SSH Backend to perform cluster automation actions.
|
|
21
21
|
|
|
22
22
|
Install via
|
|
23
|
-
```
|
|
23
|
+
```bash
|
|
24
24
|
pip install multiSSH3
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
multiSSH3 will be available as
|
|
28
|
-
```
|
|
28
|
+
```bash
|
|
29
29
|
mssh
|
|
30
30
|
mssh3
|
|
31
31
|
multissh
|
|
@@ -37,7 +37,7 @@ multissh will read a config file located at ```/etc/multiSSH3.config.json```
|
|
|
37
37
|
|
|
38
38
|
To store / generate a config file with the current command line options, you can use
|
|
39
39
|
|
|
40
|
-
```
|
|
40
|
+
```bash
|
|
41
41
|
mssh --generate_default_config_file
|
|
42
42
|
```
|
|
43
43
|
|
|
@@ -49,42 +49,52 @@ If you want to store password, it will be a plain text password in this config f
|
|
|
49
49
|
|
|
50
50
|
This option can also be used to store cli options into the config files. For example.
|
|
51
51
|
|
|
52
|
-
```
|
|
52
|
+
```bash
|
|
53
53
|
mssh --ipmi_interface_ip_prefix 192 --generate_default_config_file
|
|
54
54
|
```
|
|
55
55
|
will store
|
|
56
|
-
```
|
|
56
|
+
```json
|
|
57
57
|
"DEFAULT_IPMI_INTERFACE_IP_PREFIX": "192"
|
|
58
58
|
```
|
|
59
59
|
into the json file.
|
|
60
60
|
|
|
61
61
|
By defualt reads bash env variables for hostname aliases. Also able to read
|
|
62
|
-
```
|
|
62
|
+
```bash
|
|
63
63
|
DEFAULT_ENV_FILE = '/etc/profile.d/hosts.sh'
|
|
64
64
|
```
|
|
65
65
|
as hostname aliases.
|
|
66
66
|
|
|
67
67
|
For example:
|
|
68
|
-
```
|
|
68
|
+
```bash
|
|
69
69
|
export all='192.168.1-2.1-64'
|
|
70
70
|
mssh all 'echo hi'
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
+
Note: you probably want to set presistent ssh connections to speed up each connection events.
|
|
74
|
+
An example .ssh/config:
|
|
75
|
+
```bash
|
|
76
|
+
Host *
|
|
77
|
+
StrictHostKeyChecking no
|
|
78
|
+
ControlMaster auto
|
|
79
|
+
ControlPath /run/ssh_sockets_%r@%h-%p
|
|
80
|
+
ControlPersist 3600
|
|
81
|
+
```
|
|
82
|
+
|
|
73
83
|
It is also able to recognize ip blocks / number blocks / hex blocks / character blocks directly.
|
|
74
84
|
|
|
75
85
|
For example:
|
|
76
|
-
```
|
|
86
|
+
```bash
|
|
77
87
|
mssh testrig[1-10] lsblk
|
|
78
88
|
mssh ww[a-c],10.100.0.* 'cat /etc/fstab' 'sed -i "/lustre/d' /etc/fstab' 'cat /etc/fstab'
|
|
79
89
|
```
|
|
80
90
|
|
|
81
91
|
It also supports interactive inputs. ( and able to async boardcast to all supplied hosts )
|
|
82
|
-
```
|
|
92
|
+
```bash
|
|
83
93
|
mssh www bash
|
|
84
94
|
```
|
|
85
95
|
|
|
86
96
|
By default, it will try to fit everything inside your window.
|
|
87
|
-
```
|
|
97
|
+
```bash
|
|
88
98
|
DEFAULT_CURSES_MINIMUM_CHAR_LEN = 40
|
|
89
99
|
DEFAULT_CURSES_MINIMUM_LINE_LEN = 1
|
|
90
100
|
```
|
|
@@ -93,7 +103,7 @@ While leaving minimum 40 characters / 1 line for each host display by default. Y
|
|
|
93
103
|
|
|
94
104
|
Use ```mssh --help``` for more info.
|
|
95
105
|
|
|
96
|
-
```
|
|
106
|
+
```bash
|
|
97
107
|
usage: mssh [-h] [-u USERNAME] [-ea EXTRAARGS] [-p PASSWORD] [-11] [-f FILE] [--file_sync] [--scp] [-t TIMEOUT] [-r REPEAT] [-i INTERVAL] [--ipmi]
|
|
98
108
|
[-pre INTERFACE_IP_PREFIX] [-q] [-ww WINDOW_WIDTH] [-wh WINDOW_HEIGHT] [-sw] [-eo] [-no] [--no_env] [--env_file ENV_FILE] [-m MAXCONNECTIONS] [-j]
|
|
99
109
|
[--success_hosts] [-g] [-nw] [-su] [-sh SKIPHOSTS] [-V]
|
|
@@ -164,8 +174,6 @@ Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
|
|
|
164
174
|
- [multissh](#multissh)
|
|
165
175
|
- [Table of Contents](#table-of-contents)
|
|
166
176
|
- [Features](#features)
|
|
167
|
-
- [Installation](#installation)
|
|
168
|
-
- [Usage](#usage)
|
|
169
177
|
- [Basic Syntax](#basic-syntax)
|
|
170
178
|
- [Command-Line Options](#command-line-options)
|
|
171
179
|
- [Examples](#examples)
|
|
@@ -194,36 +202,10 @@ Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
|
|
|
194
202
|
- **Interactive Mode**: Run interactive commands with curses-based UI for monitoring.
|
|
195
203
|
- **Quiet Mode**: Suppress output for cleaner automation scripts.
|
|
196
204
|
|
|
197
|
-
## Installation
|
|
198
|
-
|
|
199
|
-
1. **Clone the Repository**
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
git clone https://github.com/yourusername/multissh.git
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
2. **Navigate to the Directory**
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
cd multissh
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
3. **Make the Script Executable**
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
chmod +x multissh.py
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
4. **Install Dependencies**
|
|
218
|
-
|
|
219
|
-
Ensure you have Python 3 and the required modules installed. You may need to install `curses` and `ipaddress` modules if they are not already available.
|
|
220
|
-
|
|
221
|
-
## Usage
|
|
222
|
-
|
|
223
205
|
### Basic Syntax
|
|
224
206
|
|
|
225
207
|
```bash
|
|
226
|
-
|
|
208
|
+
mssh [options] <hosts> <commands>
|
|
227
209
|
```
|
|
228
210
|
|
|
229
211
|
- `<hosts>`: Comma-separated list of target hosts. Supports ranges and wildcards.
|
|
@@ -267,7 +249,7 @@ Following document is generated courtesy of Mr.ChatGPT-o1 Preview:
|
|
|
267
249
|
### Running a Command on Multiple Hosts
|
|
268
250
|
|
|
269
251
|
```bash
|
|
270
|
-
|
|
252
|
+
mssh "host1,host2,host3" "uptime"
|
|
271
253
|
```
|
|
272
254
|
|
|
273
255
|
This command runs `uptime` on `host1`, `host2`, and `host3`.
|
|
@@ -275,7 +257,7 @@ This command runs `uptime` on `host1`, `host2`, and `host3`.
|
|
|
275
257
|
### Copying Files to Multiple Hosts
|
|
276
258
|
|
|
277
259
|
```bash
|
|
278
|
-
|
|
260
|
+
mssh -f "/path/to/local/file.txt" "host1,host2,host3" "/remote/path/"
|
|
279
261
|
```
|
|
280
262
|
|
|
281
263
|
This command copies `file.txt` to `/remote/path/` on the specified hosts.
|
|
@@ -283,7 +265,7 @@ This command copies `file.txt` to `/remote/path/` on the specified hosts.
|
|
|
283
265
|
### Using Hostname Ranges
|
|
284
266
|
|
|
285
267
|
```bash
|
|
286
|
-
|
|
268
|
+
mssh "host[01-05]" "hostname"
|
|
287
269
|
```
|
|
288
270
|
|
|
289
271
|
This expands to `host01`, `host02`, `host03`, `host04`, `host05` and runs `hostname` on each.
|
|
@@ -291,7 +273,7 @@ This expands to `host01`, `host02`, `host03`, `host04`, `host05` and runs `hostn
|
|
|
291
273
|
### Using IPMI
|
|
292
274
|
|
|
293
275
|
```bash
|
|
294
|
-
|
|
276
|
+
mssh --ipmi "192.168.1.[100-105]" "chassis power status"
|
|
295
277
|
```
|
|
296
278
|
|
|
297
279
|
Runs `ipmitool chassis power status` on the specified IPMI interfaces.
|
|
@@ -299,7 +281,7 @@ Runs `ipmitool chassis power status` on the specified IPMI interfaces.
|
|
|
299
281
|
### Using Password Authentication
|
|
300
282
|
|
|
301
283
|
```bash
|
|
302
|
-
|
|
284
|
+
mssh -p "yourpassword" "host1,host2" "whoami"
|
|
303
285
|
```
|
|
304
286
|
|
|
305
287
|
Uses `sshpass` to provide the password for SSH authentication.
|
|
@@ -307,7 +289,7 @@ Uses `sshpass` to provide the password for SSH authentication.
|
|
|
307
289
|
### Skipping Unreachable Hosts
|
|
308
290
|
|
|
309
291
|
```bash
|
|
310
|
-
|
|
292
|
+
mssh -su "host1,host2,host3" "date"
|
|
311
293
|
```
|
|
312
294
|
|
|
313
295
|
Skips hosts that are unreachable during execution.
|
|
@@ -315,7 +297,7 @@ Skips hosts that are unreachable during execution.
|
|
|
315
297
|
### JSON Output
|
|
316
298
|
|
|
317
299
|
```bash
|
|
318
|
-
|
|
300
|
+
mssh -j "host1,host2" "uname -a"
|
|
319
301
|
```
|
|
320
302
|
|
|
321
303
|
Outputs the results in JSON format, suitable for parsing.
|
|
@@ -323,7 +305,7 @@ Outputs the results in JSON format, suitable for parsing.
|
|
|
323
305
|
### Quiet Mode
|
|
324
306
|
|
|
325
307
|
```bash
|
|
326
|
-
|
|
308
|
+
mssh -q "host1,host2" "ls /nonexistent"
|
|
327
309
|
```
|
|
328
310
|
|
|
329
311
|
Suppresses all output, useful for scripts where you only care about exit codes.
|
|
@@ -335,8 +317,6 @@ Suppresses all output, useful for scripts where you only care about exit codes.
|
|
|
335
317
|
- Use `--no_env` to prevent loading any environment variables from files.
|
|
336
318
|
|
|
337
319
|
## Notes
|
|
338
|
-
|
|
339
|
-
- **SSH Configuration**: The script modifies `~/.ssh/config` to disable `StrictHostKeyChecking`. Ensure this is acceptable in your environment.
|
|
340
320
|
- **Dependencies**: Requires Python 3, `sshpass` (if using password authentication), and standard Unix utilities like `ssh`, `scp`, and `rsync`.
|
|
341
321
|
- **Signal Handling**: Supports graceful termination with `Ctrl+C`.
|
|
342
322
|
|