(R)?ex the friendly automation framework

News

2020-03-05
Rex-1.8.2

The Rex-1.8.2 release is now available on CPAN, fixing a bug related to task hooks.

2020-02-05
Rex-1.8.1

The Rex-1.8.1 release is now available on CPAN, improving release automation, packaging, and documentation.

2020-01-05
Rex-1.8.0

The Rex-1.8.0 release is now available on CPAN, adding initial support to manage Void Linux systems.

2019-12-05
Rex-1.7.1

The Rex-1.7.1 release is now available on CPAN, fixing a Windows testing issue, and updating some docs.

2019-11-05
Rex-1.7.0

The Rex-1.7.0 release is now available on CPAN.

Conferences

2016-06-21

Need Help?

Rex is a pure open source project, you can find community support in the following places:

Professional support is also available.

» Home » Docs » Rex book » Working with files and packages » Installing Packages

Installing Packages

Installing packages is easy. You can use the pkg function for this.

use Rex -feature => ['1.0'];
⁠
⁠user "root";
⁠password "f00b4r";
⁠
⁠task "prepare_system",
⁠  group => "frontends",
⁠  sub {
⁠    pkg "apache2", ensure => "present";
⁠  };

If you have to install multiple packages you can use an array so that you don't have to write that much.

use Rex -feature => ['1.0'];
⁠
⁠user "root";
⁠password "f00b4r";
⁠
⁠task "prepare_system",
⁠  group => "frontends",
⁠  sub {
⁠    pkg [ "apache2", "libphp5-apache2", "mysql-server" ], ensure => "present";
⁠  };

If you need to write a distribution independent module you can also use the case statement.

⁠user Rex -base;
⁠
⁠user "root";
⁠password "f00b4r";
⁠
⁠task "prepare_system",
⁠  group => "frontends",
⁠  sub {
⁠    my $packages = case operating_system,
⁠      Debian => [ "apache2", "libphp5-apache2" ],
⁠      CentOS => [ "httpd",   "php5" ],
⁠
⁠      pkg $packages, ensure => "present";
⁠  };

Proudly powered by Statocles

Google Group / Twitter / GitHub / Mailinglist / irc.freenode.net #rex   -.ô.-   Disclaimer