Created
October 16, 2012 16:50
-
-
Save krimdomu/3900504 to your computer and use it in GitHub Desktop.
Getting Hardware Information with Rex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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