https://github.com/raravena80/sshrunner
Run commands across servers using ssh
https://github.com/raravena80/sshrunner
go golang ssh
Last synced: 11 months ago
JSON representation
Run commands across servers using ssh
- Host: GitHub
- URL: https://github.com/raravena80/sshrunner
- Owner: raravena80
- License: apache-2.0
- Created: 2017-10-14T16:10:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-17T22:28:19.000Z (about 8 years ago)
- Last Synced: 2025-04-13T18:50:57.761Z (about 1 year ago)
- Topics: go, golang, ssh
- Language: Go
- Size: 56.6 KB
- Stars: 14
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# sshrunner [](https://circleci.com/gh/raravena80/sshrunner) [](https://coveralls.io/github/raravena80/sshrunner?branch=master) [](https://goreportcard.com/report/github.com/raravena80/sshrunner) [](http://godoc.org/github.com/raravena80/sshrunner) [](https://raw.githubusercontent.com/raravena80/sshrunner/master/LICENSE)
Run commands across servers using ssh
## Usage
```
Sshrunner runs an ssh command across multiple servers
Usage:
sshrunner [flags]
Flags:
-s, --agentsocket string Socket for the ssh agent (default "/private/tmp/com.apple.launchd.xxx/Listeners")
-c, --command string Command to run
--config string config file (default is $HOME/.sshrunner.yaml)
-h, --help help for sshrunner
-k, --key string Ssh key to use for authentication, full path (default "/Users/raravena/.ssh/id_rsa")
-m, --machines strings Hosts to run command on
-p, --port int Ssh port to connect to (default 22)
-a, --useagent Use agent for authentication
-u, --user string User to run the command as (default "raravena")
```
## Examples
Makes /tmp/tmpdir in 17.2.2.2 and 17.2.3.2:
```
$ sshrunner -c "mkdir /tmp/tmpdir" -m 17.2.2.2,17.2.3.2
```
Creates /tmp/file file in host1 and host2
```
$ sshrunner -c "touch /tmp/file" -m host1,host2
```
Moves a file and creates another one in host1 and host2:
```
$ sshrunner -c "mv /tmp/file1 /tmp/file2; touch /tmp/file3" -m host1,host2
```
Runs with default in `~/.sshrunner.yaml`
```
$ sshrunner
```
## Config
Sample `~/.sshrunner.yaml`
```
sshrunner:
user: ubuntu
key: /Users/username/.ssh/id_rsa
useagent: true
machines:
- 172.1.1.1
- 172.1.1.2
- 172.1.1.3
- 172.1.1.4
- 172.1.1.5
command: sudo rm -f /var/log/syslog.*
```