https://github.com/seajoshc/dothisonthat
Do This On That (dtot) sequentially runs commands on one or more hosts in the specified order
https://github.com/seajoshc/dothisonthat
automation linux ruby sysadmin
Last synced: 5 months ago
JSON representation
Do This On That (dtot) sequentially runs commands on one or more hosts in the specified order
- Host: GitHub
- URL: https://github.com/seajoshc/dothisonthat
- Owner: seajoshc
- License: mit
- Created: 2014-01-01T04:54:04.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2018-06-12T21:55:07.000Z (about 8 years ago)
- Last Synced: 2026-01-14T10:41:26.241Z (6 months ago)
- Topics: automation, linux, ruby, sysadmin
- Language: Ruby
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# About
Do This On That (dtot) sequentially runs plain shell commands on one or more hosts in the specified order. You need SSH public key authentication already setup on the target hosts. You can run a single command across multiple hosts by running dtot from the command line with arguments, or you can feed dtot a list of commands and hosts by using some helper files. See the Usage section below for more information.
# Usage
```gem install dtot```
```dtot --help```
Specify commands followed by multiple hosts to run commands, sequentially, on all hosts in specified order. Uses the currently logged in, local user as the username on the target systems.
```dtot -c uptime,w,"ls -lah /" -w host1,host2,host3```
```dtot -c "sudo yum update -y" -w host1,host2```
Or, use "do this" and "on that" files:
```dtot -d do_this -o on_that```
## do_this
Each command should be on one line; commands are run sequentially, not in parallel (by design). See the example do_this in the examples directory of this repository.
## on_that
On each line put the username with access followed by a space and then the hostname. You should have public key authentication already setup on the host for the user specified. See the example on_that in the examples directory of this repository.
## Docker
First, retrieve the image from Docker Hub:
```
docker pull irlrobot/dtot
```
Next, create your do_this and on_that files in a directory on your local machine. I typically just use ~/Desktop on my Mac.
Finally, run the below from the directory where your do_this and on_that files are located:
```
docker run --rm \
-v ~/.ssh/id_rsa:/root/.ssh/id_rsa \
-v ~/.ssh/id_rsa.pub:/root/.ssh/id_rsa.pub \
-v ~/Desktop/do_this:/dtot/commands \
-v ~/Desktop/on_that:/dtot/hosts \
dtot
```
NOTE: The Docker image currently only supports SSH keys without a passphrase.