NAME

Rex::IO::Client - Client Library for Rex::IO::Server

GETTING HELP

METHODS

new()

Constructor

get_service($service)

Request information of $service.

add_service($service, $option)

Create a new service $service with the options provided by $option. $option is a hashRef.

rm_service($name)

Remove $service.

get_server($server)

Request information of $server.

add_server($name, $option)

Create a new server $name. With the options provided by $option. $option is a hashRef.

list_server()

Returns a list of all servers known to the CMDB.

list_service()

Returns a list of all services kown to the CMDB.

FUNCTIONS

cmdb_get($key)

You can use this function inside your Rexfile to get configuration parameters from Rex::IO::CMDB.

my @configuration = cmdb_get("service://$service_name/$service_section");

Example of a Rexfile:

# Rexfile
use Rex::IO::Client;
   
set group => "frontends" => "fe01", "fe02";
   
task "prepare_ntp", group => "frontends", sub {
   file "/etc/ntp.conf",
      content => template("templates/etc/ntp.conf.tpl", cmdb_get("service://ntp/configuration")),
      owner   => "root",
      mode    => 644;
       
   service ntpd => "start";
};

And your ntp.conf template file can look like this:

server  <%= $::server %>
   
<% for my $restrict_srv (@{ $::restrict }) { %>
restrict  <%= $restrict_srv %>
<% } %>
  
driftfile /var/run/ntp/drift