(R)?ex the friendly automation framework



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.


The Rex-1.12.2 release is now available on CPAN. It fixes various regressions, as well as bugs around file management. Upgrade is highly recommended for all users.


The Rex-1.12.1 release is now available on CPAN. It adds documentation for feature flags, and fixes a release packaging issue.


The Rex-1.12.0 release is now available on CPAN. It adds support for local rsync operations, improves tab completion for Bash and Zsh, and fixes related bugs. It also discontinues support for running Rex on Windows 7, Windows Server 2008 R2, and older versions since both mainstream and extended support has already ended for these products.



Need Help?

Rex is a pure open source project, you can find community support in the following places:

Professional support is also available.

» 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

Google Group / Twitter / GitHub / Mailinglist / irc.freenode.net #rex   -.ô.-   Disclaimer