I have a nat and it has various server So from my local server I want to go to nat and then from nat i have to ssh to other machines
Local-->NAT(abcuser@publicIP with key 1)-->server1(xyzuser@localIP with key 2) nat has different ssh key and each of the server has different ssh key how can i accomplish this type of multihop ssh using fabric I tried using env.roledefs feature but it doesnt seems to be working also I am not sure how to define two ssh keys.I know we can define a list of keys with env.key_filename but issue is will it check each key with each server?How can I be more specific and match a key with one server only
I have tried using command from my local machine fab deploy -g '[email protected]' -i '/home/aman/Downloads/aws_oms.pem' and my script is
from __future__ import with_statement
from fabric.api import local, run, cd, env, execute
env.hosts=['[email protected]']
env.key_filename=['/home/ec2-user/varnish_cache.pem']
def deploy():
run("uname -a")
In order to connect to remote hosts via an intermediate server, you can use the
--gateway
command-line option :http://docs.fabfile.org/en/latest/usage/fab.html#cmdoption-g
Or, alternatively, set the
env.gateway
variable inside your fabfile :http://docs.fabfile.org/en/latest/usage/env.html#gateway
For more detail information, see:
http://docs.fabfile.org/en/stable/concepts/networking.html#ssh-gateways