sgsullivan / befehl

Run arbitrary commands over ssh in mass

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

befehl

Run arbitrary commands over ssh in mass

  • run the given payload(s) in PWD on host(s) in config.json.. up to 2000 at a time.

./befehl execute --runconfig config.json --routines 2000

Output of each payload run for every node will be in the log directory (by default, its $HOME/befehl/logs) in a file named after the machine it ran on.

An example runconfig (config.json shown above) is shown below:

{
  "payload": "integration_tests/examples/payload",
  "user": "root",
  "hosts": [{
      "host": "127.0.0.1",
      "port": 1000
    },
    {
      "host": "127.0.0.1",
      "port": 1001,
      "user": "snowflake",
      "payload": "integration_tests/examples/payload-override"
    },
    {
      "host": "127.0.0.1",
      "port": 1002
    },
    {
      "host": "127.0.0.1",
      "port": 1003
    },
    {
      "host": "127.0.0.1",
      "port": 1004
    }
  ]
}

As you can see, you can override the payload from the default, as 127.0.0.1:1001 is doing in the example above.

Configuration

You can configure befehl with a config file (~/.befehl.[toml|json|yaml]) any serialization format that upstream viper supports befehl supports for the config file. Valid configuration options:

[general]
logdir = "/home/ssullivan/log-special"
[ssh]
privatekeyfile = "/home/ssullivan/alt/id_rsa"
knownhostspath = "/home/asullivan/alt/.ssh/known_hosts"
hostkeyverificationenabled = true

Unless enabled as shown above, ssh known host verification is disabled.

Obtaining prebuilt binaries

Head on over to the releases page to get prebuilt binaries for your platform.

Building

Once you have your Go environment setup, it should be as simple as cloning this git repo and running make. The resulting binary will be located at _exe/befehl.

About

Run arbitrary commands over ssh in mass

License:Apache License 2.0


Languages

Language:Go 90.6%Language:Shell 6.6%Language:Makefile 1.9%Language:Dockerfile 0.9%