Skip to content

raravena80/sshrunner

Repository files navigation

sshrunner CircleCI Build Status Coverage Status Go Report Card Documentation Apache Licensed

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.*

About

Run commands across servers using ssh

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published