http://www.perlmonks.org?node_id=1209821

vasanth.easyrider has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl monks

I have a requirement where i need to connect to 900 routers and execute few commands and capture the output. I am using Net::OpenSSH module for fulfilling my requirement. But we have ssh key authentication issue that is causing a problem for me. I cant manually connect to 900 servers to establish the SSH key. Is there a method for me to tackle it in script. The script given below is being used to connect to 1 router and execute the command

#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; my ($ssh,$password); my $host = "10.0.0.183"; my $user_name = q(username); $password = q(My_Password); $ssh = Net::OpenSSH->new($host, user => $user_name, password => $passw +ord); my $output = $ssh->system("show isis neighbors") or die "remote command failed: " . $ssh->error; print "output is = $output\n";