diff --git a/orchestrate.py b/orchestrate.py index 0217379550b8d17dd16f92214cf3b97c8a5df436..c9ef33c3cacaa51c667bb77e9e449a9a80d46c2a 100755 --- a/orchestrate.py +++ b/orchestrate.py @@ -136,14 +136,26 @@ if 'init' in args.actions: h = list(hosts.keys()) + ['%s.%s.' % (host, d) for host in hosts.keys()] + \ ['%s.%s' % (host, d) for host in hosts.keys()] + list(hosts.values()) + [master_ip] + cycle_all = \ + 'echo -n At:; uname -n; for h in %s; do ssh -o StrictHostKeyChecking=no $h :; done' \ + % (' '.join(h)) commands = [ ['ssh-keygen', '-R', master_ip], ['ssh', '-o', 'StrictHostKeyChecking=no', '%s@%s' % (user, master_ip), ':'], ['scp', '-p', 'hosts', '%s@%s:/tmp/' % (user, master_ip)], ['ssh', '%s@%s' % (user, master_ip), 'sudo mv -v /tmp/hosts /etc/hosts'], - ['ssh', '-o', 'ForwardAgent=yes', '%s@%s' % (user, master_ip), - 'for h in %s; do ssh -o StrictHostKeyChecking=no %s@$h :; done' % (' '.join(h), user)], + # the frontend to all nodes + ['ssh', '-o', 'ForwardAgent=yes', '%s@%s' % (user, master_ip), cycle_all] ] + for node in hosts.keys(): + # skip the frontend - covered by the command above + if node == master_hostname: + continue + # the node to all nodes + commands += [ + ['ssh', '-o', 'ForwardAgent=yes', '%s@%s' % (user, master_ip), + 'ssh -o ForwardAgent=yes %s \'%s\'' % ('%s.%s' % (node, d), cycle_all)], + ] for ip in hosts.values(): commands += [ ['ssh-keygen', '-R', ip],