#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH::Parallel; use Net::OpenSSH::Parallel::Constants qw(:error :on_error); my @hosts=('192.168.0.19','192.168.0.18'); my $pssh = Net::OpenSSH::Parallel->new(); my @errors=(OSSH_ON_ERROR_IGNORE,OSSH_ON_ERROR_RETRY,OSSH_ON_ERROR_DONE,OSSH_ON_ERROR_ABORT,OSSH_ON_ERROR_ABORT_ALL,OSSH_JOIN_FAILED,OSSH_ABORTED,OSSH_GOTO_FAILED); foreach my $host ( @hosts ) { $pssh->add_host($host,user =>'root',passwd=>'access') or print "Error----\n"; }