Skip to content

Instantly share code, notes, and snippets.

@krimdomu
Created October 16, 2012 16:50
Show Gist options
  • Save krimdomu/3900504 to your computer and use it in GitHub Desktop.
Save krimdomu/3900504 to your computer and use it in GitHub Desktop.
Getting Hardware Information with Rex
use Rex::Hardware;
use Data::Dumper;
user "root";
password "f00b4r";
pass_auth;
group myservers => "server1", "server2", "server3";
task "get-info", group => "myservers", sub {
my %hw_info = Rex::Hardware->get(qw/ All /);
say Dumper(\%hw_info);
say "IP of eth0 is: " . $hw_info{Network}->{networkconfiguration}->{eth0}->{ip};
my $hostname = run "hostname";
say "The hostname is: $hostname";
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment