Difference between revisions of "Rex"

From Leaky
Jump to: navigation, search
(Tips for using rex)
(No difference)

Revision as of 10:26, 7 November 2013

Download from http://rexify.org/ - the easiest way is to create a yum repo file since this will allow it to pull in other dependencies.

cat > /etc/yum.repos.d/rex.repo <<'EOF'
[rex]
name=Fedora $releasever - $basearch - Rex Repository
baseurl=http://rex.linux-files.org/CentOS/$releasever/rex/$basearch/
enabled=1
EOF

Defining groups

group "web" => "web[1..7]";
group "misc" => "ns1", "ns2", "dev";

Force -q always

To make it act like -q is always passed, simply add the following to the Rexfile

$::QUIET = 1;

Passing parameters to a rex task

Just use @ARGV in the same way as normal, except that $ARGV[1] is the first parameter, rather than $ARGV[0]

task "version", group => ["web", "misc"], sub {
    my $servername = connection->server;
    say $servername . ": " . run "rpm -q " . $ARGV[1];
};
$ rex -q version centos-release