I need to deal with a lot of remote machines, and each machine shares a global environment variable ( like CONTROLLER_IP). When I try to ssh to the remote machine, I would like to set the CONTROLLER_IP according to current localhost setting. is there any way to make it happen?
Example:
In localhost host, I set ofc1=192.168.0.1, and ofc2=192.168.1.1 and I need to ssh to ofs1, ofs2. I would like to do something like:
CONTROLLER_IP=$ofc1 ssh root@ofs1; CONTROLLER_IP=$ofc2 ssh root@ofs2
then I will get the CONTROLLER_IP setting in each ssh session. (the code shown above does not work...)