1Rex(3) User Contributed Perl Documentation Rex(3)
2
3
4
6 Rex - Remote Execution
7
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
17 · Automate common tasks.
18
19 · Provision servers using Rex's builtin tools.
20
21 You can find examples and howtos on <http://rexify.org/>
22
24 · Web Site: <http://rexify.org/>
25
26 · IRC: irc.freenode.net #rex
27
28 · Bug Tracker: <https://github.com/RexOps/Rex/issues>
29
30 · Twitter: <http://twitter.com/jfried83>
31
33 # In a Rexfile:
34 use Rex -feature => [qw/1.3/];
35
36 user "root";
37 password "ch4ngem3";
38
39 desc "Show Unix version";
40 task "uname", sub {
41 say run "uname -a";
42 };
43
44 1;
45
46 # On the command line:
47 bash# rex -H server[01..10] uname
48
49 See rex <https://metacpan.org/pod/distribution/Rex/bin/rex> for more
50 information about how to use rex on the command line.
51
52 See Rex::Commands for a list of all commands you can use.
53
55 get_current_connection
56 This function is deprecated since 0.28! See Rex::Commands::connection.
57
58 Returns the current connection as a hashRef.
59
60 server
61 The server name
62
63 ssh 1 if it is a ssh connection, 0 if not.
64
65 is_ssh
66 Returns 1 if the current connection is a ssh connection. 0 if not.
67
68 is_local
69 Returns 1 if the current connection is local. Otherwise 0.
70
71 is_sudo
72 Returns 1 if the current operation is executed within sudo.
73
74 get_sftp
75 Returns the sftp object for the current ssh connection.
76
77 connect
78 Use this function to create a connection if you use Rex as a library.
79
80 use Rex;
81 use Rex::Commands::Run;
82 use Rex::Commands::Fs;
83
84 Rex::connect(
85 server => "remotehost",
86 user => "root",
87 password => "f00b4r",
88 private_key => "/path/to/private/key/file",
89 public_key => "/path/to/public/key/file",
90 );
91
92 if(is_file("/foo/bar")) {
93 print "Do something...\n";
94 }
95
96 my $output = run("uptime");
97
99 Many thanks to the contributors for their work. Please see CONTRIBUTORS
100 <https://github.com/RexOps/Rex/blob/master/CONTRIBUTORS> file for a
101 complete list.
102
104 Rex is a free software, licensed under: The Apache License, Version
105 2.0, January 2004
106
107
108
109perl v5.28.1 2017-03-01 Rex(3)