I have one central machine and multiple remote machines. Configured passwordless connections to remote machines from central machine.
I have to login from central vm to remote vm's and execute script in remote vm's
Below is the example, what i am trying
Central Machine:
#!/bin/sh
ssh root@remotemachine1
#run runscript.py in remotemachine1
ssh root@remotemachine2
#run runscript.py in remotemachine2
Remote Machine
python runscript.py
runscript.py
device = ["device1","device2","device3"]
for i, x enumerate(device):
print "{}. {}".format(i+1, x)
select_device = raw_input("Choose Device: ")
print "You Selected Device {}".format(device[int(select_device) - 1])
do something
....
....
....
....
repeat = raw_input("Do you want to repeat? Y/N:")
do something
........
........
........
Someone help me how to login and run script in remote1 machine and exit from remote1 machine and run script in remote2 machine.