(R)?ex the friendly automation framework



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.

Rex on StackShare

Thanks to the support from their amazing team, Rex is now listed on StackShare.


The Rex-1.11.0 release is now available on CPAN. It enhances the behaviour of sysctl and file management, fixes bugs about group management and OpenSSH connection options, and clarifies quite a bit of documentation.


The Rex-1.10.0 release is now available on CPAN (changelog). Apart from documentation updates and bug fixes, it adds initial package glob support, and an on_change hook for the mkdir command.


The Rex-1.9.0 release is now available on CPAN, and it adds a new feature flag to force writing UTF-8 encoded files, documents configuration options, and fixes bugs.



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 » Guides » A word on backward compatibility

A word on backward compatibility

Like any good software project, Rex improves with each new version. This is a good thing. But it would be a bummer if the Rexfiles you wrote broke after upgrading to a new version of Rex. You've got better things to do than go back and fix Rexfiles to make them compatible with new versions. So Rex does its best to ensure newer versions of Rex are backward compatible with your existing Rexfiles by implementing feature flags, which is a small bit of code you place in your Rexfile to break backward compatibility.

How Feature Flags Work

By default, all old Rex features will work with your Rexfile. If you want to take advantage of new features, you must add a feature flag to your Rexfile to tell Rex that you don't mind breaking backward compatibility and removing older features. In other words, the default is for your Rexfile to always to be backward compatible unless you add a feature flag to tell it otherwise. As a general rule of thumb, when creating a new Rexfile, you should use a feature flag to turn off backward compatibility.

If your Rexfiles are broken by an update, this is considered to be a bug. Please report this bug in our issue tracker.

Feature flags

This is the current list of feature flags:

Flag Since Description
1.4 1.4 Break all backward compatibility
no_task_chaining_cmdline_args 1.4 Disable per-task argument parsing
task_chaining_cmdline_args 1.4 Enable per-task argument parsing: rex --rex --args task1 --task1arg=value task2 --task2arg so task1 only gets task1arg and task2 only gets task2arg.
1.3 1.3 Activating the new template engine by default.
no_template_ng 1.3 Disabling the new template engine.
1.0 1.0 Disabling usage of a tty. This increases compatibility for remote execution. Furthermore, all features from earlier versions are activated.
no_autodie 1.0 Will disable autodie feature.
tty 1.0 Enable pty usage for ssh connections. (Default)
template_ng 0.56 Enabling the new template engine (better error reporting, etc.)
0.56 0.56 Will activate autodie feature. Furthermore, all features from earlier versions are activated.
autodie 0.56 Will enable autodie feature: die on all failed filesytem commands
0.55 0.55 Will activate using Net::OpenSSH by default if present. Furthermore, all features from earlier versions are activated.
0.54 0.54 Will activate checking services for existence before trying to manipulate them, and set() will overwrite already existing values (instead of concatenating). Furthermore, all features from earlier versions are activated.
0.53 0.53 Will activate register_cmdb_top_scope. And all things 0.51 and down activated.
register_cmdb_top_scope 0.53 Will register all cmdb top scope variables automatically in the templates.
0.51 0.51 Will load Rex::Constants and the CMDB by default. And all things 0.47 and down activated.
disable_taskname_warning 0.47 Disable warning about invalid task names (they should match /^[a-zA-Z_][a-zA-Z0-9_]*$/)
verbose_run 0.47 Explicitly output "Successfully executed" or "Error executing" messages for run() commands.
no_cache 0.46 Disable caching (like discovery results of remote OS, hardware, shell, etc.)
no_path_cleanup 0.44 Rex cleans the path before executing a command. With this feature Rex doesn't cleanup the path.
source_profile 0.44 Source $HOME/.profile before running a command.
source_global_profile 0.44 Source /etc/profile before running a command.
exec_autodie 0.44 If you execute a command with run() Rex will die() if the command returns a RETVAL != 0.
exec_and_sleep 0.43 Sometimes some commands that fork away didn't keep running. With this flag rex will wait a few ms before exiting the shell.
disable_strict_host_key_checking 0.43 Disabling strict host key checking for openssh connection mode.
reporting 0.43 Enable reporting
empty_groups 0.42 Enable usage of empty groups.
use_server_auth 0.42 Enable the usage of special authentication options for servers.
no_tty 0.41 Disable pty usage for ssh connections.
no_local_template_vars 0.40 Use global variables in templates
sudo_without_sh 0.40 Run sudo commands directly without the use of 'sh'. This might break things.
sudo_without_locales 0.40 Run sudo commands without locales. This will break things if you don't use English locales.
exit_status 0.39 This option tells Rex to return a non zero value on exit if a task fails.
0.35 0.35 This option enables the features of 0.31 and the possibility to call tasks as a functions without the need to use a hash reference for the parameters.
0.31 0.31 To enable special authentication options for a server group. This will overwrite the default authentication options for a task.

Howto enable Feature Flags

You can enable feature flags in your Rexfile with the following code:

# Rexfileuse Rex -feature => ['1.4']; # breaks all backward compatibility

or even multiple ones like this:

# Rexfileuse Rex -feature => [qw(exec_autodie source_profile)]; # enable the exec_autodie and source_profile features

Proudly powered by Statocles

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