-
-
05 Jul 2021 21:04:56 UTC
- Distribution: Rex
- Module version: v1.13.4
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (710 / 4 / 2)
- Kwalitee
Bus factor: 2- 49.25% Coverage
- License: apache_2_0
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (342.78KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 118 contributors-
Jan Gehring
-
A Happy User
-
Alexander Romanenko
-
Alexandr Ciornii
-
Alex Mestiashvili
-
Ali Polatel
-
alx542
-
Anders Ossowicki
-
Andrej Zverev
-
Andrew Solomon
-
Andy Beverley
-
Arnold Bechtoldt
-
Boris Däppen
-
Brian Manning
-
Cameron Daniel
-
Chris Steigmeier
-
Christophe Wolfhugel
-
Crimson Thompson
-
Daniel Bäurer
-
Daniel Cesario
-
Daniel Dico
-
Denis Silakov
-
Dmitry Kopytov
-
Dominik Schulz
-
E. Choroba
-
Eduardo J
-
Eivin Giske Skaaren
-
elisdg
-
Elmer Quintanilla
-
Eric Johnson
-
Erik Huelsmann
-
Ferenc Erki
-
Franky Van Liedekerke
-
Fran Rodriguez
-
Gabor Szabo
-
Graham Todd
-
Harm Müller
-
Hayato Imai
-
Hiroaki Nakamura
-
Hiroki Matsuo
-
iblinder
-
Ilya Pavlov
-
James D Bearden
-
jdelgado7
-
Jean Charles Passard
-
Jean-Marie Renouard
-
Jeen Lee
-
Jens Berthold
-
Joachim Bargsten
-
John Karr
-
Jon Gentle
-
Joris DE POOTER
-
Jose Luis Martinez
-
Jose Luis Perez Diez
-
Kasim Tuman
-
Keedi Kim
-
Ken Crowell
-
Kent Fredric
-
Kirill Babikhin
-
labbeduddel
-
Leah Neukirchen
-
LeMerP
-
Mario Domgoergen
-
Max E. Aubrey
-
Mitch Broadhead
-
Nathan Abu
-
Naveed Massjouni
-
necrophcodr
-
Nicolas Leclercq
-
Nigel Gregoire
-
Nikolay A. Fetisov
-
Nils Domrose
-
okaoka
-
Oleg Hardt
-
Olivier Cherrier
-
Orange
-
Paco Esteban
-
Patrick Lauer
-
Pavel Timofeev
-
perlancar
-
Peter H. Ezetta
-
Peter Manthey
-
petersonchen
-
Pierrick DINTRAT
-
Piotr Karbowski
-
Prajithp
-
Randy Lauen
-
Renée Bäcker
-
Robert Abraham
-
Roy Storey
-
Samuele Tognini
-
Sascha Askani
-
Sascha Guenther
-
Simon Bertrang
-
Solène Rapenne
-
Stephane Benoit
-
Steve Dondley
-
Sven Dowideit
-
Tamas Molnar
-
Tianon Gravi
-
Tokuhiro Matsuno
-
Tomohiro Hosaka
-
Volker Kroll
-
Walery Wysotsky
-
Yanick Champoux
-
Yegor Korablev
-
Zane C. Bowers-Hadley
-
Сергей Романов
-
范野人
-
饶琛琳
-
Cuong Manh Le
-
David Golovan
-
Dominik Danter
-
Ilya Evseev
-
Niklas Larsson
-
Qiao Liu
-
Renato CRON
-
Peter Jankovics
- Dependencies
- AWS::Signature4
- Carp
- Cwd
- Data::Dumper
- Data::Validate::IP
- Devel::Caller
- Digest::HMAC_SHA1
- Digest::MD5
- English
- Exporter
- Fcntl
- File::Basename
- File::Spec
- File::Spec::Unix
- File::Spec::Win32
- FindBin
- HTTP::Request
- HTTP::Request::Common
- Hash::Merge
- IO::File
- IO::Select
- IO::Socket
- IO::String
- IPC::Open3
- JSON::MaybeXS
- LWP::UserAgent
- List::Util
- MIME::Base64
- Net::OpenSSH::ShellQuoter
- POSIX
- Scalar::Util
- Sort::Naturally
- Storable
- Symbol
- Term::ReadKey
- Test::Builder::Module
- Text::Glob
- Text::Wrap
- Time::HiRes
- UNIVERSAL
- URI
- URI::QueryParam
- XML::Simple
- YAML
- attributes
- base
- constant
- lib
- overload
- strict
- vars
- version
- warnings
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- DESCRIPTION
- SYNOPSIS
- EXPORTED FUNCTIONS
- get_operating_system
- operating_system
- get_system_information
- kernelname
- dump_system_information
- operating_system_is($string)
- operating_system_version()
- operating_system_release()
- network_interfaces
- memory
- is_freebsd
- is_redhat
- is_fedora
- is_suse
- is_mageia
- is_debian
- is_alt
- is_netbsd
- is_openbsd
- is_linux
- is_bsd
- is_solaris
- is_windows
- is_openwrt
- is_gentoo
- is_arch
- is_void
NAME
Rex::Commands::Gather - Hardware and Information gathering
DESCRIPTION
With this module you can gather hardware and software information.
All these functions will not be reported. These functions don't modify anything.
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(); };
Aliased by operating_system().
operating_system
Alias for get_operating_system()
get_system_information
Will return a hash of all system information. These Information will be also used by the template function.
kernelname
Will return the kernel name of the operating system. For example on a linux system it will return Linux.
dump_system_information
This function dumps all known system information on stdout.
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."; } };
operating_system_version()
Will return the os release number as an integer. For example, it will convert 5.10 to 510, 10.04 to 1004 or 6.0.3 to 603.
task "prepare", "server01", sub { if( operating_system_version() >= 510 ) { say "OS Release is higher or equal to 510"; } };
operating_system_release()
Will return the os release number as is.
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 iterate 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 FreeBSD.
task "foo", "server1", "server2", sub { if(is_freebsd) { say "This is a freebsd system..."; } else { say "This is not a freebsd system..."; } };
is_redhat
task "foo", "server1", sub { if(is_redhat) { # do something on a redhat system (like RHEL, Fedora, CentOS, Scientific Linux } };
is_fedora
task "foo", "server1", sub { if(is_fedora) { # do something on a fedora system } };
is_suse
task "foo", "server1", sub { if(is_suse) { # do something on a suse system } };
is_mageia
task "foo", "server1", sub { if(is_mageia) { # do something on a mageia system (or other Mandriva followers) } };
is_debian
task "foo", "server1", sub { if(is_debian) { # do something on a debian system } };
is_alt
task "foo", "server1", sub { if(is_alt) { # do something on a ALT Linux system } };
is_netbsd
Returns true if the target system is a NetBSD.
task "foo", "server1", "server2", sub { if(is_netbsd) { say "This is a netbsd system..."; } else { say "This is not a netbsd system..."; } };
is_openbsd
Returns true if the target system is an OpenBSD.
task "foo", "server1", "server2", sub { if(is_openbsd) { say "This is an openbsd system..."; } else { say "This is not an openbsd system..."; } };
is_linux
Returns true if the target system is a Linux System.
task "prepare", "server1", "server2", sub { if(is_linux) { say "This is a linux system..."; } else { say "This is not a linux system..."; } };
is_bsd
Returns true if the target system is a BSD System.
task "prepare", "server1", "server2", sub { if(is_bsd) { say "This is a BSD system..."; } else { say "This is not a BSD system..."; } };
is_solaris
Returns true if the target system is a Solaris System.
task "prepare", "server1", "server2", sub { if(is_solaris) { say "This is a Solaris system..."; } else { say "This is not a Solaris system..."; } };
is_windows
Returns true if the target system is a Windows System.
is_openwrt
Returns true if the target system is an OpenWrt System.
is_gentoo
Returns true if the target system is a Gentoo System.
is_arch
task "foo", "server1", sub { if(is_arch) { # do something on a arch system } };
is_void
Returns true if the target system is a Void Linux system.
Module Install Instructions
To install Rex, copy and paste the appropriate command in to your terminal.
cpanm Rex
perl -MCPAN -e shell install Rex
For more information on module installation, please visit the detailed CPAN module installation guide.