(R)?ex the friendly automation framework



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.


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.



» 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 / IRC / Twitter / Google Groups / StackShare / Mailing list / Server Fault   -.ô.-   Disclaimer