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

NAME

6       Rex - the friendly automation framework
7

DESCRIPTION

9       Rex is an automation framework that is friendly to any combinations of
10       local and remote execution, push and pull style of management, or
11       imperative and declarative approach.
12
13       Its flexibility makes it a great fit for many different use cases, but
14       most commonly Rex is used to automate application deployment and data
15       center infrastructure management tasks.
16

SYNOPSIS

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

USAGE

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

Rexfile

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