NAME

Rex::Commands::Gather - Hardware and Information gathering

DESCRIPTION

With this module you can gather hardware and software information.

SYNOPSIS

operating_system_is("SuSE");

EXPORTED FUNCTIONS

get_operating_system

Will return the current operating system name.

task "get-os", "server01", sub {
   say get_operating_system();
};
operating_system_is($string)

Will return 1 if the operating system is $string.

task "is_it_suse", "server01", sub {
   if( operating_system_is("SuSE") ) {
      say "This is a SuSE system.";
   }
};
network_interfaces

Return an HashRef of all the networkinterfaces and their configuration.

task "get_network_information", "server01", sub {
   my $net_info = network_interfaces();
};

You can interate over the devices as follow

my $net_info = network_interfaces();
for my $dev ( keys %{ $net_info } ) {
   say "$dev has the ip: " . $net_info->{$dev}->{"ip"} . " and the netmask: " . $net_info->{$dev}->{"netmask"};
}
memory

Return an HashRef of all memory information.

task "get_memory_information", "server01", sub {
   my $memory = memory();
    
   say "Total:   " . $memory->{"total"};
   say "Free:    " . $memory->{"free"};
   say "Used:    " . $memory->{"used"};
   say "Cached:  " . $memory->{"cached"};
   say "Buffers: " . $memory->{"buffers"};
};
is_freebsd

Returns true if the target system is a BSD.

task "foo", "server1", "server2", sub {
   if(is_freebsd) {
      say "This is a bsd system...";
   }
   else {
      say "This is not a bsd system...";
   }
};