Magnet is a tool which helps you to SSH to host(s). It gets list of hosts from your service discovery system(for example consul), builds dictionary of keywords and associates hostname/IP with keywords.
Magnet supports plugins. If you use custom service discovery system you can write your own plugin.
magnet.py
- main interfaceconsole.sh
- script which opens console of your preference (edit console.sh
before first run)magnet.conf
- defines what plugin to use and path to console.sh
python-pip3
- must be installed before executing python3 setup.py install
These packages will be installed by setup.py
:
python-qt4
- for GUIxdotool
- for managing tabs in your terminalpyyaml
xdotool
emulates keys press. It’s shortcut for new tab. Default key combinations for konosle and gnome-terminal is Ctrl+Shift+tssh -l user
or your ssh wrapper(in case you use jump host).OPTIONAL STEP
In case you don’t have everything in service discovery but want magnet to add these hosts to shared DB you can do this by adding records to static_inventory.yaml, section hosts
. Format is simple:
"ip or DNS name":
- any name
- keyword1
- keyword2
Another cool feature - aliases. Imagin in service discovery you have registered service - “cool.app”. But in your team, everybody call this app - fatboy
. fatboy is unofficial name and for convenience you can assign local alias.
Format:
aliases:
fatboy: cool.app
spaceship: cool.app
....
I tried different approaches, because the idea was to write single script for every possible terminal, but I end up with separate function for KDE konsole and everything else. xdotool
has couple of downsides. All of them are related to keyboard layout. Needless to say konsole
has perfect dbus support. Apparently this is the best choice for konsole
. Hope this is finally version of console.sh