NAME

RackMan::Template - Simple templating module for RackMan

SYNOPSIS

    use RackMan::Template;

    my $tmpl = RackMan::Template->new(filename => "dhcp.tmpl");
    $tmpl->param(dhcp_server => "192.168.0.13");
    print $tmpl->output;

DESCRIPTION

This module is a simple Moose-based templating class, based on HTML::Template and HTML::Template::Filter::TT2. Please read the documentation of these modules for more details on the syntax.

METHODS

new

(delegated to HTML::Template)

Create and return a new object.

param

(delegated to HTML::Template)

Pass parameters to the template.

populate_from

Add to the template the parameters documented in "TEMPLATE PARAMETERS" from the Rackman::Device and RackMan objects given in argument.

    my $tmpl = RackMan::Template->new(filename => $tmpl_path);
    $tmpl->populate_from($rackdev, $rackman);

output

(delegated to HTML::Template)

Generate and return the output from the template and the given parameters.

TEMPLATE PARAMETERS

When the method populate_from() is called with valid RackMan::Device and Rackman objects given in arguments, it populates the template object with the following parameters:

  • dns_server_1, dns_server_2, dns_server_3 - DNS servers

  • gateway - IPv4 address of the default gateway

  • fqdn - FQDN of the host

  • name - common name of the host

  • if0_ip - IPv4 address of the first regular network interface

  • if0_mac - MAC address of the first regular network interface

  • if0_name - name of the first regular network interface

  • netmask - IPv4 network mask

  • network - IPv4 network address

  • type - RackObject type

The corresponding RackObject attributes are also available, with their names mogrified to be valid identifiers: units are removed, some punctuation characters (dot (.), comma (,)) are removed, the alphabetical characters are lowercased and the rest of non word characters are collapsed and converted to underscores (_).

Here is a non authoritative list of known attributes: alias, alive_check, contact_person, cpu, dram flash_memory, fqdn, has_jumbo_frames, hw_type, hw_warranty_expiration, hypervisor, max_power, max_current, oem_sn_1, oem_sn_2, sw_type, sw_version, sw_warranty_expiration, use, uuid.

SEE ALSO

HTML::Template, HTML::Template::Filter::TT2

AUTHOR

Sebastien Aperghis-Tramoni