(R)?ex the friendly automation framework

Automate everything, relax anytime

  • > There is more than one way to manage it
  • > Easy to learn, use and extend
  • > It's (not) just Perl
  • > Apache 2.0 licensed
task prepare => sub {
  pkg     'apache2', ensure => 'latest';
  service 'apache2', ensure => 'started';
};
Read the getting started guide

News

2024-11-05
Rex-1.15.0

Happy 14th birthday, Rex!

Rex-1.15.0 is now available on CPAN. It contains bug several bug fixes and a few new features.

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.

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).

(R)?ex, the friendly automation framework

Puts you in charge

Rex acknowledges that instead of silver bullets, there is more than one way to manage it.

It's friendly to any combinations of local and remote execution, push and pull style of management, or imperative and declarative approach. Instead of forcing any specific model on you, it trusts you to be in the best position to decide what to automate and how, allowing you to build the automation tool your situation requires.

Easy to get on board

Automate what you are doing today, and add more tomorrow.

Rex runs locally, even if managing remotes via SSH. This means it's instantly usable, without big rollout processes or anyone else to convince, making it ideal and friendly for incremental automation.

Get started »

It's just Perl

Perl is a battle-tested, mature language, and Rex code is just Perl code.

This means whenever you reach the limitations of the built-in Rex features, a powerful programming language and module ecosystem is always at your fingertips to seamlessly extend it with modules from CPAN or with your own code.

As a bonus, you can also use the usual well-established tools and workflows, like IDE integration for syntax highlighting, linting and formatting, or authoring and publishing Rex modules on CPAN.

With the use of Inline and FFI::Platypus modules, it's friendly to code written in other languages too. So after all, it's not just Perl.

Just enough Perl for Rex »

Open source

We believe in the idea of open source. So Rex, and all its parts are released under the Apache 2.0 license. You're invited to join the community to make Rex better and better.

View details »

Show me the code!

Uptime?

This command line example will execute uptime on all the given hosts (frontend01, frontend02, ...):

$ rex -H "frontend[01..05]" -e "say run 'uptime'"

The same, but with a Rexfile

use Rex -feature => ['1.4'];

desc 'Get uptime';
task 'uptime', 'frontend[01..05]', sub {
    say run 'uptime';
};

Now you can run your task with this command:

$ rex uptime

Keep your configuration in sync

This example will install the Apache web server on 5 machines and keep their configuration in sync. If the deployed configuration file changes, it will automatically reload the service.

use Rex -feature => ['1.4'];

user 'root';
group frontend => 'frontend[01..05]';

desc 'Prepare frontend server';
task 'prepare',
  group => 'frontend',
  sub {
    pkg 'apache2', ensure => 'present';

    service 'apache2', ensure => 'started';
  };

desc 'Keep configuration in sync';
task 'configure',
  group => 'frontend',
  sub {
    prepare();

    file '/etc/apache2/apache2.conf',
      source    => 'files/etc/apache2/apache2.conf',
      on_change => sub { service apache2 => 'reload'; };
  };

Need to use sudo?

You can also run everything with sudo. Just replace the authentication information with the following:

user 'ubuntu';
sudo TRUE;
sudo_password 'mysudopw';

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