(R)?ex the friendly automation framework



Rex-1.14.3 is now available on CPAN. It contains bug fixes for local package installation, command existence checks, and Git tests.


The Rex-1.14.2 release is now available on CPAN. It contains bug fixes for running local commands on Windows, cloning git repositories, and test suite fixes for the upcoming perl-5.38.0 release.

Call for papers TPRC 2023

Dean Hamstead from the The Perl and Raku Foundation Marketing Committee has sent an invitation to present about Rex at TPRC 2023. I’m posting it here to increase visibility.


The Rex-1.14.1 release is now available on CPAN. It contains bug fixes and documentation updates.


The Rex-1.14.0 release is now available on CPAN. It contains improved Rexfile loading, documentation updates, and bumps the minimum required Perl version to 5.12.5.


Learning automation using Rex

Ferenc Erki (FErki) will be the guest of Gábor Szabó on the next Code Maven live stream to learn about automation using Rex. Register for the free event via Code Maven or Meetup, and join the discussion!

Unexpected use cases with Rex

Unexpected use cases with Rex at the 22nd German Perl/Raku Workshop 2020 in Erlangen by Ferenc Erki (FErki).

Rex & Friends

Rex & Friends talk at the Barcelona Perl & Friends 2019 by Ferenc Erki (FErki).

» Home » Docs » Release notes » Release notes for 0.4

Release notes for 0.4


desc "Get Hardware Information"; task "hw-info", "testsystem", sub { my %hw = Rex::Hardware->get(qw/ Host Kernel Memory Network Swap /);
<span class="hljs-function">print</span> Dumper( \<span class="hljs-type">%hw</span> );


Will produce the following example output:

<pre><code class="hljs"><span class="hljs-type">$VAR1</span> = {
'<span class="hljs-string">Network</span>' =&gt; {
    '<span class="hljs-string">networkdevices</span>'       =&gt; [ '<span class="hljs-string">eth0</span>', '<span class="hljs-string">wlan0</span>' ],
    '<span class="hljs-string">networkconfiguration</span>' =&gt; {
        '<span class="hljs-string">wlan0</span>' =&gt; {
            '<span class="hljs-string">broadcast</span>' =&gt; '<span class="hljs-string"></span>',
            '<span class="hljs-string">ip</span>'        =&gt; '<span class="hljs-string"></span>',
            '<span class="hljs-string">netmask</span>'   =&gt; '<span class="hljs-string"></span>',
            '<span class="hljs-string">mac</span>'       =&gt; '<span class="hljs-string">00:21:5C:5C:1E:5F</span>'
        '<span class="hljs-string">eth0</span>' =&gt; {
            '<span class="hljs-string">broadcast</span>' =&gt; <span class="hljs-function">undef</span>,
            '<span class="hljs-string">ip</span>'        =&gt; <span class="hljs-function">undef</span>,
            '<span class="hljs-string">netmask</span>'   =&gt; <span class="hljs-function">undef</span>,
            '<span class="hljs-string">mac</span>'       =&gt; '<span class="hljs-string">00:1C:25:94:B0:85</span>'
'<span class="hljs-string">Memory</span>' =&gt; {
    '<span class="hljs-string">shared</span>'  =&gt; '<span class="hljs-string">0</span>',
    '<span class="hljs-string">buffers</span>' =&gt; '<span class="hljs-string">36</span>',
    '<span class="hljs-string">free</span>'    =&gt; '<span class="hljs-string">3168</span>',
    '<span class="hljs-string">used</span>'    =&gt; '<span class="hljs-string">792</span>',
    '<span class="hljs-string">total</span>'   =&gt; '<span class="hljs-string">3961</span>',
    '<span class="hljs-string">cached</span>'  =&gt; '<span class="hljs-string">407</span>'
'<span class="hljs-string">Kernel</span>' =&gt; {
    '<span class="hljs-string">kernelversion</span>' =&gt; '<span class="hljs-string">#1 SMP PREEMPT 2011-02-21 10:34:10 +0100</span>',
    '<span class="hljs-string">architecture</span>'  =&gt; '<span class="hljs-string">x86_64</span>',
    '<span class="hljs-string">kernel</span>'        =&gt; '<span class="hljs-string">Linux</span>',
    '<span class="hljs-string">kernelrelease</span>' =&gt; '<span class="hljs-string"></span>'
'<span class="hljs-string">Swap</span>' =&gt; {
    '<span class="hljs-string">free</span>'  =&gt; '<span class="hljs-string">3812</span>',
    '<span class="hljs-string">used</span>'  =&gt; '<span class="hljs-string">0</span>',
    '<span class="hljs-string">total</span>' =&gt; '<span class="hljs-string">3812</span>'
'<span class="hljs-string">Host</span>' =&gt; {
    '<span class="hljs-string">domain</span>'                 =&gt; '<span class="hljs-string">site</span>',
    '<span class="hljs-string">manufacturer</span>'           =&gt; '<span class="hljs-string">LENOVO</span>',
    '<span class="hljs-string">hostname</span>'               =&gt; '<span class="hljs-string">linux-ymf0.site</span>',
    '<span class="hljs-string">operatingsystemrelease</span>' =&gt; '<span class="hljs-string">11.4</span>',
    '<span class="hljs-string">operatingsystem</span>'        =&gt; '<span class="hljs-string">SuSE</span>'


# include for ,,operating_system_is'' Function use Rex::Commands::Gather;

user "root";

private_key "/Users/jan/.ssh/id_rsa"; public_key "/Users/jan/.ssh/is_rsa.pub";

# group servers group "test" => "debian01", "centos01", "suse01";

# run tasks in parallel parallelism 2;

desc "Prepare System"; task "prepare", group => "test", sub {

<span class="hljs-comment"># check if operating system is CentOS, because on CentOS vim is</span><span class="hljs-comment">

# available through the package "vim-enhanced". if ( operating_system_is("CentOS") ) { install package => "vim-enhanced"; } else { install package => "vim"; }

install <span class="hljs-keyword">package</span> =&gt; "<span class="hljs-string">mc</span>";


This task will install *vim* and *mc* on all the 3 systems.

Proudly powered by Perl and built with Statocles

GitHub repository and discussions / Chat on Matrix and IRC / Mailing list on Google Groups (retired: rex-users@freelists)

MetaCPAN / Twitter / StackShare / Server Fault   -.ô.-   Disclaimer