(R)?ex the friendly automation framework



The Rex-1.13.4 release is now available on CPAN. It contains documentation updates, and a fix for inconsistent behavior between the content and source options of the file command.


The Rex-1.13.3 release is now available on CPAN. It contains documentation updates, and a fix for debconf parsing. Behind the scenes, CI was migrated over to GitHub Actions as well.


The Rex-1.13.2 release is now available on CPAN. It contains only documentation updates, mostly for the built-in template capabilities, but also fixes a few typos.


Happy 10th birthday, Rex!

The Rex-1.13.1 release is now available on CPAN. It is focusing on CMDB bugfixes and documentation, while also fixing a missing feature flag. Upgrade is recommended for all users.


The Rex-1.13.0 release is now available on CPAN. It adds on_no_change hooks for file management commands to trigger further actions when files are left unchanged. Upgrade is recommended for all users.


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 Statocles

GitHub / Matrix / IRC / Twitter / Google Groups / StackShare / Mailing list / Server Fault   -.ô.-   Disclaimer