NAME

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

GETTING HELP

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