i2cssh is a tool that allows you to log in to multiple servers simultaneously in iTerm2, arranging SSH panes automatically for simultaneous operations.
https://github.com/wouterdebie/i2cssh
To log in to multiple target servers via the same bastion host, you can use:
i2cssh -Xt=user@bastion.example.com "ssh user@server1.example.com" "ssh user@server2.example.com"
like this.
If you are using Python Fabric, you can do it like this:
if getattr(env, 'gateway'):
local('i2cssh -Xt={} {}'.format(
env.gateway,
' '.join('"ssh {}@{}"'.format(env.user, h)
for h in env.hosts)))
It looks something like this.
Comments