(R)?ex the friendly automation framework

News

2023-08-05
Rex-1.14.3

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

2023-05-05
Rex-1.14.2

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.

2023-03-17
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.

2023-03-05
Rex-1.14.1

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

2023-02-05
Rex-1.14.0

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.

Events

2021-03-08
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!

2020-03-05
Unexpected use cases with Rex

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

2019-11-09
Rex & Friends

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

» Home » Docs » Release notes » Release notes for 0.43

Release notes for 0.43

Common

Inventory cache

If you want to cache the inventory and to use this cache for subsequent rex calls, you can use the REX_CACHE_TYPE environment variable.

REX_CACHE_TYPE=YAML rex $task

This will create a folder ".cache" and creates a separate cache file for each host. If you want to use a different folder you can set it in the REX_CACHE_PATH environment variable.

You can also set the cache type inside your Rexfile

# Rexfile

user "root";
password "...";
cache "YAML";

It is also possible to create custom cache classes. For example if you want to save the inventory cache inside a database. Just take a look at Rex::Interface::Cache::YAML to see how it is implemented.

Reporting of changes

If you want to get a report of the changes Rex had done on your systems, you can use the new reporting feature.

Currently not every Rex function gets monitored by this feature, but all important ones are. This feature will be extended with version 2 of rex.

To activate the reporting you can use the REX_REPORT_TYPE environment variable or use the reporting feature inside your Rexfile.

REX_REPORT_TYPE=YAML rex the-task

Or, within the Rexfile

# Rexfile
use Rex -base;
report -on => "YAML";

The YAML report will be created inside a directory called report. If you want to use a different directory you can set it with a special variable.

use Rex -base;
report -on => "YAML";
set report_path => "/path/to/";

It is also possible to create custom reporting classes. Just take a look at Rex::Report::RexIO.

New CLI commands to better integrate Rex into your shell scripts

With these commands it is easy to use Rex from within a shell script.

You can test these scripts by checking out the krimdomu/rex-shell-extension GitHub repository.

Login to fe01.my.lan and execute uptime

#!/bin/bash
export REX_REMOTE_HOST="fe01.my.lan"
GROUPS=$(rex-run "id -Gn www-data")
for group in $GROUPS; do
    echo $group
done

Login to fe01.my.lan, testing if /etc/sudoers is there, and if not, install package and upload a template sudoers file

#!/bin/bash
export REX_REMOTE_HOST="fe01.my.lan"

if ! rex-test -f /etc/sudoers; then
   rex-install sudo
   rex-template files/sudoers.tpl | rex-upload "/etc/sudoers"
fi

Initial support for OpenWrt (FErki)

In a limited way, Rex now supports OpenWrt.

Enhancements

rex will now only upload a file if it really changes and it will upload the file into a temporary file and rename it after the upload.

task "mytask", "myserver", sub { };

Bugfixes

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