#!/usr/bin/env perl # -*- mode: perl-ts; -*- use 5.32.0; use strict; use warnings; use FindBin; use lib "${FindBin::Bin}/lib"; use Test2::V0; use FAPG::TestSupport qw(@HOSTS); use Net::SSH::Perl; foreach my $h (@HOSTS) { my ( $out, $err, $exit ); my $timeout = 5; my $ok = eval { local $SIG{ALRM} = sub { die "SSH timeout after $timeout seconds.\n" }; alarm $timeout; my $ssh = Net::SSH::Perl->new( $h->{hostname}); $ssh->login( $h->{user}, $h->{password} ); ( $out, $err, $exit ) = $ssh->cmd('true'); 1; }; alarm 0; ok $ok, "host $h->{hostname} can be reached via ssh"; diag $@ if $@; } done_testing();