(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

2021-07-05
Rex-1.13.4

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.

2021-03-05
Rex-1.13.3

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.

2020-12-05
Rex-1.13.2

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.

2020-11-05
Rex-1.13.1

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.

2020-10-05
Rex-1.13.0

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.

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 Statocles

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