Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ See "Issue #33 Refactoring Details" section below for comprehensive breakdown.
- `main.rs` - Clean entry point (69 lines)
- `app/dispatcher.rs` - Command routing and dispatch (368 lines)
- `app/initialization.rs` - App initialization and config loading (206 lines)
- `app/nodes.rs` - Node resolution and filtering (242 lines)
- `app/nodes.rs` - Node resolution, filtering, and exclusion (587 lines)
- `app/cache.rs` - Cache statistics and management (142 lines)
- `app/query.rs` - SSH query options handler (58 lines)
- `app/utils.rs` - Utility functions (62 lines)
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ bssh -C production "df -h"
bssh -H "web1,web2,db1,db2" -f "web*" "systemctl status nginx"
bssh -C production -f "db*" "pg_dump --version"

# Exclude specific hosts from execution
bssh -H "node1,node2,node3" --exclude "node2" "uptime"
bssh -C production --exclude "db*" "systemctl restart nginx"
bssh -C production --exclude "web1,web2" "apt update"

# With custom SSH key
bssh -C staging -i ~/.ssh/custom_key "systemctl status nginx"

Expand Down Expand Up @@ -915,7 +920,9 @@ bssh -F ~/.ssh/prod-config -C production upload app.tar.gz /opt/
```
Options:
-H, --hosts <HOSTS> Comma-separated list of hosts (user@host:port format)
-c, --cluster <CLUSTER> Cluster name from configuration file
-C, --cluster <CLUSTER> Cluster name from configuration file
-f, --filter <PATTERN> Filter hosts by pattern (supports wildcards like 'web*')
--exclude <HOSTS> Exclude hosts from target list (comma-separated, supports wildcards)
--config <CONFIG> Configuration file path [default: ~/.config/bssh/config.yaml]
-u, --user <USER> Default username for SSH connections
-i, --identity <IDENTITY> SSH private key file path (prompts for passphrase if encrypted)
Expand Down
40 changes: 40 additions & 0 deletions docs/man/bssh.1
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,27 @@ Filter hosts by pattern (supports wildcards like 'web*').
Use with -H or -C to execute on a subset of hosts.
Example: -f "web*" matches web01, web02, etc.

.TP
.BR \-\-exclude " " \fIHOSTS\fR
Exclude hosts from target list (comma-separated).
Supports wildcard patterns: '*' (any chars), '?' (single char), '[abc]' (char set).
Patterns with wildcards use glob matching; plain patterns use substring matching.
Applied after --filter option.
.RS
.PP
Examples:
.IP \[bu] 2
--exclude "node2" - Exclude single host
.IP \[bu] 2
--exclude "web1,web2" - Exclude multiple hosts
.IP \[bu] 2
--exclude "db*" - Exclude hosts starting with 'db'
.IP \[bu] 2
--exclude "*-backup" - Exclude backup nodes
.IP \[bu] 2
--exclude "web[12]" - Exclude web1 and web2
.RE

.TP
.BR \-\-parallel " " \fIPARALLEL\fR
Maximum parallel connections for multi-server mode (default: 10)
Expand Down Expand Up @@ -1051,6 +1072,25 @@ Executes command only on hosts matching the pattern 'web*'
Executes command only on database nodes in the production cluster
.RE

.TP
Exclude specific hosts from execution:
.B bssh -H "node1,node2,node3" --exclude "node2" "uptime"
.RS
Executes command on node1 and node3, excluding node2
.RE

.TP
.B bssh -C production --exclude "db*" "systemctl restart nginx"
.RS
Executes command on all production hosts except database servers
.RE

.TP
.B bssh -C production --exclude "web1,web2" "apt update"
.RS
Excludes specific hosts web1 and web2 from the cluster operation
.RE

.TP
Test connectivity:
.B bssh -C production ping
Expand Down
Loading