1REX(1)                User Contributed Perl Documentation               REX(1)
2
3
4

NAME

6       (R)?ex - (Remote)? Execution
7

DESCRIPTION

9       Rex is a command line tool which executes commands on remote servers.
10       Define tasks in Perl and execute them on remote servers or groups of
11       servers.
12
13       Rex can be used to:
14
15       - Deploy web applications to servers sequentially or in parallel.
16       - Automate common tasks.
17       - Provision servers using Rex's builtin tools.
18

SYNOPSIS

20           bash# rex -h                      # Show usage
21           bash# rex -T                      # List tasks
22           bash# rex uname                   # Run the 'uname' task
23           bash# rex -H server[01..10] uname # Run the 'uname' task on all the specified hosts
24           bash# rex -G production uname     # Run 'uname' on hosts on the 'production' hostgroup
25           bash# rex deploy --gracefully     # Pass '--gracefully' to the 'deploy' task
26

USAGE

28           rex [<options>] [-H <host>] [-G <group>] <task> [<task-options>]
29           rex -T[m|y|v] [<string>]
30
31           -b     Run batch
32           -e     Run the given code fragment
33           -E     Execute a task on the given environment
34           -G|-g  Execute a task on the given server groups
35           -H     Execute a task on the given hosts (space delimited)
36           -z     Execute a task on hosts from this command's output
37
38           -K     Public key file for the ssh connection
39           -P     Private key file for the ssh connection
40           -p     Password for the ssh connection
41           -u     Username for the ssh connection
42
43           -d     Show debug output
44           -ddd   Show more debug output (includes profiling output)
45           -m     Monochrome output: no colors
46           -o     Output format
47           -q     Quiet mode: no log output
48           -qw    Quiet mode: only output warnings and errors
49           -Q     Really quiet: output nothing
50
51           -T     List tasks
52           -Tm    List tasks in machine-readable format
53           -Tv    List tasks verbosely
54           -Ty    List tasks in YAML format
55
56           -c     Turn cache ON
57           -C     Turn cache OFF
58           -f     Use this file instead of Rexfile
59           -F     Force: disregard lock file
60           -h     Display this help message
61           -M     Load this module instead of Rexfile
62           -O     Pass additional options, like CMDB path
63           -s     Use sudo for every command
64           -S     Password for sudo
65           -t     Number of threads to use (aka 'parallelism' param)
66           -v     Display (R)?ex version
67

Rexfile

69       When you run "rex" it reads the file "Rexfile" in the current working
70       directory. A Rexfile consists of 2 major parts: Configuration and Task
71       Definitions.
72
73   Configuration
74       Simple Authentication
75
76           user "bruce";
77           password "batman";
78           pass_auth;
79
80       Key Authentication
81
82           private_key "/path/to/your/private/key.file";
83           public_key "/path/to/your/public/key.file";
84
85       Define Logging
86
87           logging to_file => "rex.log";
88           logging to_syslog => "local0";
89
90       Group your servers
91
92       Rex gives you the ability to define groups of servers. Groups can be
93       defined the Rexfile:
94
95           group "frontends" => "frontend01", "frontend02", "frontend03", "frontend04", "frontend[05..09]";
96
97       Groups can also be defined in a server.ini file:
98
99           [frontends]
100           frontend[01..04]
101
102   Other Configuration
103           timeout 10;    # ssh timeout
104           parallelism 2; # execute tasks in parallel
105
106   Defining tasks
107       A basic task looks like this:
108
109           # task description
110           desc "This task tells you how long since the server was rebooted";
111
112           # task definition
113           task "shortname", sub {
114               say run "uptime";
115           };
116
117       You can also set a default server group:
118
119           desc "This is a long description of a task";
120           task "shortname", group => "frontends", sub {
121               say run "uptime";
122           };
123
124
125
126perl v5.28.1                      2017-03-01                            REX(1)
Impressum