This script automates launching SSH sessions to hosts defined in an Ansible inventory file.
It parses the inventory file (at ./hosts
) and understand Ansible patterns like webserver[0:1],db[4:10]:!db9.stuff.com
.
So if you have this inventory for example:
[webserver]
webserver01.stuff.com
webserver02.stuff.com
webserver03.stuff.com
db
foo.stuff.com
bar.stuff.com
And you run main.py db[0],webserver[0:1]
then it will do this:
- create a new tmux window
- create a new pane for each host matched (3 in this example) running ssh to the host
- retiling the window
- go the first pane
- enable synchronized input (meaning what you type is replicated in all panes for this window)