NAME
Rex::Commands::Pkg - Install/Remove Software packages
DESCRIPTION
With this module you can install packages and files.
SYNOPSIS
install file => "/etc/passwd", {
source => "/export/files/etc/passwd"
};
install package => "perl";
EXPORTED FUNCTIONS
- install($type, $data, $options)
-
The install function can install packages (for CentOS, OpenSuSE and Debian) and files.
- installing a package (This is only supported on CentOS, OpenSuSE and Debian systems.)
-
task "prepare", "server01", sub { install package => "perl"; # or if you have to install more packages. install package => [ "perl", "ntp", "dbus", "hal", "sudo", "vim", ]; };
- installing a file
-
task "prepare", "server01", sub { install file => "/etc/passwd", { source => "/export/files/etc/passwd", owner => "root", group => "root", mode => 644, }; };
- installing a file and do somthing if the file was changed.
-
task "prepare", "server01", sub { install file => "/etc/httpd/apache2.conf", { source => "/export/files/etc/httpd/apache2.conf", owner => "root", group => "root", mode => 644, on_change => sub { say "File was modified!"; } }; };
- installing a file from a template.
-
task "prepare", "server01", sub { install file => "/etc/httpd/apache2.tpl", { source => "/export/files/etc/httpd/apache2.conf", owner => "root", group => "root", mode => 644, on_change => sub { say "File was modified!"; }, template => { greeting => "hello", name => "Ben", }, }; };
- remove($type, $package, $options)
-
This function will remove the given package from a system.
task "cleanup", "server01", sub { remove package => "vim"; };