Rex - Online Linux Manual PageSection : 3
Updated : 2021-03-06
Source : perl v5.32.1
Note : User Contributed Perl Documentation
NAMERex − the friendly automation framework
DESCRIPTIONRex is an automation framework that is friendly to any combinations of local and remote execution, push and pull style of management, or imperative and declarative approach. Its flexibility makes it a great fit for many different use cases, but most commonly Rex is used to automate application deployment and data center infrastructure management tasks. See Rex::Commands for a starting point of available built-in commands. See rex <https://metacpan.org/pod/distribution/Rex/bin/rex> for more information about how to use rex on the command line.
SYNOPSIS # In a Rexfile:
use Rex −feature => [qw/1.4/];
user "root";
password "ch4ngem3";
desc "Show system information";
task "sysinfo", sub {
say run "uname −a";
};
1;
# On the command line:
$ rex −H server[01..10] sysinfo
CLASS METHODS
get_current_connectionThis function is deprecated since 0.28! See Rex::Commands::connection. Returns the current connection as a hashRef. server The server name ssh 1 if it is a ssh connection, 0 if not.
is_sshReturns 1 if the current connection is a ssh connection. 0 if not.
is_localReturns 1 if the current connection is local. Otherwise 0.
is_sudoReturns 1 if the current operation is executed within sudo.
get_sftpReturns the sftp object for the current ssh connection.
connectUse this function to create a connection if you use Rex as a library. use Rex;
use Rex::Commands::Run;
use Rex::Commands::Fs;
Rex::connect(
server => "remotehost",
user => "root",
password => "f00b4r",
private_key => "/path/to/private/key/file",
public_key => "/path/to/public/key/file",
);
if(is_file("/foo/bar")) {
print "Do something...\n";
}
my $output = run("uptime");
FEATURE FLAGSEveryone knows the pain if something gets deprecated and one has to port his old (and stable) code to a new version of a library or a framework. There is enough work to do instead of fixing code to work with newer versions of them. So there is one promise new versions of Rex has to fulfill. They must be backward compatible. I know this might be impossible in one way or another, but to minimize this danger there is a thing called feature flags. If there is the need to break backward compatibility in favor of a new feature there will be a feature flag for this change. And only if this feature flag gets enabled in the Rexfile it will break compatibility. So the default is always to remain compatible. If you have a problem that occurs after an update, it is considered as a bug. Please report this bug in our issue tracker. Also see the backwards compatibility <https://metacpan.org/release/Rex/source/CONTRIBUTING.md#backwardscompatibility> section of the CONTRIBUTING guide.
How to enable feature flagsYou can enable feature flags in your Rexfile with the following code: use Rex −feature => ['1.4'];
or even multiple ones like this: use Rex −feature => [qw(1.4 exec_autodie)];
List of feature flags1.4 Enable per-task argument parsing (task_chaining_cmdline_args). Furthermore, all features from earlier versions are activated. Available since version 1.4. no_task_chaining_cmdline_args Disable per-task argument parsing. Available since version 1.4. task_chaining_cmdline_args Enable per-task argument parsing: rex −−rex −−args task1 −−task1arg=value task2 −−task2arg so task1 only gets task1arg and task2 only gets task2arg. Available since version 1.4. 1.3 Activating the new template engine by default. Furthermore, all features from earlier versions are activated. Available since version 1.3. no_template_ng Disabling the new template engine. Available since version 1.3. 1.0 Disabling usage of a tty. This increases compatibility for remote execution. Furthermore, all features from earlier versions are activated. Available since version 1.0. no_autodie Will disable autodie feature. Available since version 1.0. tty Enable pty usage for ssh connections. Available since version 1.0. template_ng Enabling the new template engine (better error reporting, etc.). Available since version 0.56. 0.56 Will activate autodie feature. Furthermore, all features from earlier versions are activated. Available since version 0.56. autodie Will enable autodie feature: die on all failed filesytem commands <https://metacpan.org/pod/Rex::Commands::Fs>. Available since version 1.13.1. 0.55 Will activate using Net::OpenSSH by default if present. Furthermore, all features from earlier versions are activated. Available since version 0.55. 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. Available since version 0.54. 0.53 Will activate register_cmdb_top_scope. And all things 0.51 and down activated. Available since version 0.53. register_cmdb_top_scope Will register all cmdb top scope variables automatically in the templates. Available since version 0.53. 0.51 Will load Rex::Constants and the CMDB by default. And all things 0.47 and down activated. Available since version 0.51. disable_taskname_warning Disable warning about invalid task names (they should match /^[a−zA−Z_][a−zA−Z0−9_]*$/). Available since version 0.47. verbose_run Explicitly output ‟Successfully executed” or ‟Error executing” messages for run() commands. Available since version 0.47. no_cache Disable caching (like discovery results of remote OS, hardware, shell, etc.). Available since version 0.46. no_path_cleanup Rex cleans the path before executing a command. With this feature Rex doesn't cleanup the path. Available since version 0.44. source_profile Source $HOME/.profile before running a command. Available since version 0.44. source_global_profile Source /etc/profile before running a command. Available since version 0.44. exec_autodie If you execute a command with run() Rex will die() if the command returns a RETVAL != 0. Available since version 0.44. exec_and_sleep Sometimes some commands that fork away didn't keep running. With this flag rex will wait a few ms before exiting the shell. Available since version 0.43. disable_strict_host_key_checking Disabling strict host key checking for openssh connection mode. Available since version 0.43. reporting Enable reporting. Available since version 0.43. empty_groups Enable usage of empty groups. Available since version 0.42. use_server_auth Enable the usage of special authentication options for servers. Available since version 0.42. no_tty Disable pty usage for ssh connections. Available since version 0.41. no_local_template_vars Use global variables in templates. Available since version 0.40. sudo_without_sh Run sudo commands directly without the use of 'sh'. This might break things. Available since version 0.40. sudo_without_locales Run sudo commands without locales. This will break things if you don't use English locales. Available since version 0.40. exit_status This option tells Rex to return a non zero value on exit if a task fails. Available since version 0.39. 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. Available since version 0.35. 0.31 To enable special authentication options for a server group. This will overwrite the default authentication options for a task. Available since version 0.31.
CONTRIBUTORSMany thanks to the contributors for their work. Please see CONTRIBUTORS <https://metacpan.org/release/Rex/source/CONTRIBUTORS> file for a complete list.
LICENSERex is a free software, licensed under: The Apache License, Version 2.0, January 2004 0
Johanes Gumabo
Data Size : 24,826 byte
man-Rex.3pmBuild : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 2 / 170,934
Visitor ID : :
Visitor IP : 18.189.182.15 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (parse_manual_page_|249|Rex.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\|
) (htmlprn|149|Rex.3pm|36/37|.el══─{─══. ds -- — |.el══─{─══. ds -- \|\(em\|
) (parse_manual_page_|249|Rex.3pm|43|br══─}─══|'br══─}─══
) (htmlprn|149|Rex.3pm|43|'br══─}─══ |'br══─}─══
)