Use your existing ClusterSSH cluster groups with parallel-ssh tools. No duplicate host lists -- one source of truth in ~/.clusterssh/clusters, including nested group expansion.
sudo apt install pssh clustersshgit clone https://github.com/oneidprod/pssh4cssh.git /path/to/pssh4csshAdd to your ~/.bashrc (use the path where you cloned it):
source /path/to/pssh4cssh/pssh4cssh.shThen reload (or open a new terminal):
source ~/.bashrcAll commands take a cluster group name as the first argument, followed by the normal arguments for that tool.
pssh-c vps-all "uptime"
pssh-c vps-arm "df -h /"
pssh-c vps-amd "free -h"pscp-c vps-all /local/file.conf /remote/path/prsync-c vps-all -r /local/dir/ /remote/dir/pslurp-c vps-all /var/log/syslog ./logs/Groups that reference other groups in your clusters file are expanded recursively. For example if your clusters file contains:
vps-amd ubuntu@host1 ubuntu@host2
vps-arm ubuntu@host3 ubuntu@host4
vps-all vps-amd vps-arm
Then pssh-c vps-all will expand to all four hosts automatically.
Shows disk usage for /dev/sda1 and NFS mounts across a cluster, sorted by free space.
# All servers
./df-summary
# Specific group
./df-summary vps-armOutput is split into two sections:
=== /dev/sda1 ===
HOST FILESYSTEM SIZE USED FREE USE%
----------------------------------------------------------------------------------------------
ubuntu@10.0.0.1 /dev/sda1 45G 28G 18G 61%
ubuntu@10.0.0.2 /dev/sda1 45G 42G 3.4G 93%
=== NFS Mounts ===
HOST FILESYSTEM SIZE USED FREE USE%
----------------------------------------------------------------------------------------------
ubuntu@10.0.0.3 10.0.0.1:/var/nfs/shared 45G 35G 11G 77%
logrotate-wallets uses pssh4cssh to deploy a logrotate config to a fleet of VPS servers in one shot:
pscp-c vps-all wallet-debug-logrotate.conf /home/ubuntu/
pssh-c vps-all "sudo mv ~/wallet-debug-logrotate.conf /etc/logrotate.d/wallet-debug && sudo chown root:root /etc/logrotate.d/wallet-debug && sudo chmod 644 /etc/logrotate.d/wallet-debug"If you find this useful, tips are appreciated:
| Coin | Address |
|---|---|
| LTC | LWpuHQUGw3qZg8MCHYGgTPRZ3a1i8jc5u3 |
| BTC | bc1qw0t40dunylgtz9kgfylwxac3a8vwp70cgrga5r |
| SOL | up9YvW6ewNati5fmmDjGHzFbq8UkSbHPccoDNzijk3G |
| POL | 0x5198f52fA768294ae66f0cB75A98DCc895a36F2E |
| DOGE | DJAg2fTzS5vN3yXDPn5gGPz9JSmzJn3cXD |
Each line is a group name followed by its members separated by spaces. Members can be hostnames, user@host addresses, or other group names for nesting:
# Simple group
vps-amd ubuntu@10.0.0.1 ubuntu@10.0.0.2 ubuntu@10.0.0.3
# Another group
vps-arm ubuntu@10.0.1.1 ubuntu@10.0.1.2 ubuntu@10.0.1.3
# Nested group -- expands vps-amd and vps-arm automatically
vps-all vps-amd vps-arm
Lines starting with # are comments and are ignored. You don't need ClusterSSH installed -- just create ~/.clusterssh/clusters with your groups.
By default pssh4cssh reads ~/.clusterssh/clusters. Override with:
export CSSH_CLUSTERS=/path/to/your/clustersMIT © oneidprod