The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

rack - Fetch information and generate config files for RackObjects

SYNOPSIS

    rack [--config /etc/rack.conf] <action> <action options> <object>
    rack { --help | --man | --version }

OPTIONS

Standard options

-c, --config path

Specify the path to the configuration file. Default to /etc/rack.conf

-v, --verbose

Run the program in verbose mode.

Program options

--device-login username

Specify an alternate login for connecting onto the device.

--device-password password

Specify an alternate password for connecting onto the device.

--dhcp-template path

Specify an alternate template path for RackMan::Format::DHCP.

-F, --formats list of formats

Specify a comma-separated list of formats, overriding the corresponding [device:*]/formats parameters in rack.conf

--ks, --kickstart-template path

Specify an alternate template path for RackMan::Format::Kickstart.

--no-write-device-config

Do not write the device specific file of the given RackObject.

-G, --only-formats list of formats

Alias for the --formats and --no-write-device-config options.

-o, --output path

Specify the path of the output file for the Generic format.

--pxe-template path

Specify an alternate template path for RackMan::Format::PXE.

--read-community community

Specify an alternate SNMP read community.

-S, --scm

Use a SCM program to version generated files. Enabled by default (use --no-scm to disable).

-t, --template path

Specify the path of the template file for the Generic format.

--write-community community

Specify an alternate SNMP write community.

Help options

-h, --help

Print a short usage description, then exit.

--man

Print the manual page of the program, then exit.

-V, --version

Print the program name and version, then exit.

ARGUMENTS

Arguments are expected to be:

  • the action name: diff, dump, info, list, push, write

  • optional action options

  • the RackObject name

DESCRIPTION

rack is a command for fetching information from a RackTables database about selected RackObjects, generate the corresponding configuration files and talk with the corresponding devices to set them up accordingly.

ACTIONS

list

Print the list of RackObjects of the given type (server, pdu, switch or all)

Options

  • as - specify the format: ldif, simple (default)

info

Print information about the RackObject

dump

Print the structure of the RackObject

Options

  • as - specify the format: json, ldif, perl, yaml (default)

diff

Print the differences between the actual and expected configuration of the device. Set exit status to 1 if there are differences, 0 otherwise.

write

Generate and write the configuration files corresponding to the RackObject

push

Push the configuration to the device corresponding to the RackObject.

EXAMPLES

List all the PDUs:

    rack list pdu

List all the servers in LDIF format:

    rack list servers as ldif

Print information about "front01.example.com" in default format (YAML):

    rack info front01.example.com

Dump information about "front01.example.com" in JSON format:

    rack dump as json front01.example.com
    rack dump front01.example.com as json

Write all the configuration files for "front01.example.com":

    rack write frontal01.example.com

Only write the DHCP file for "front01.example.com":

    rack write -G DHCP frontal01.example.com

Process the template input.tmpl with the information about "front01.example.com" and print the result on screen:

    rack write -G Generic -t input.tmpl frontal01.example.com

Process the template input.tmpl with the information about "front01.example.com" and write the result on disk, in a file named after the device:

    rack write -G Generic -t input.tmpl -o %name%.conf frontal01.example.com

CONFIGURATION

The configuration file is expected to be in the .INI format, with the following sections and parameters.

All parameters can be overridden in a per-device file named rack.local.conf, read from [general]/path (read below).

Parameters can contain placeholders that will be replaced with values corresponding to the given RackObjet:

  • %name% - name of the RackObject, or "unknown" if it is undefined

Section [general]

  • default_scm - specify the default SCM program

  • dns_servers - specify the list of default DNS servers (space separated)

  • mail_server - specify the default SMTP server

  • management_interfaces - specify the regular expression which matches the names of management interfaces. Default is /(areca|ilo|ipmi)/

  • nagios_url - specify the URL of the Nagios web application

  • ntp_servers - specify the list of default NTP servers (space separated)

  • path - (mandatory) specify the path for device-specific configuration files, including rack.local.conf; it is therefore strongly suggested to use the %name% placeholder somewhere in the value

  • racktables_url - specify the URL of the RackTables web application

  • timezone - specify the default timezone

  • virtual_interfaces - specify the regular expression which matches the names of virtual interfaces. Default is /(carp|lagg|vlan)\d+/

Section [database]

  • dsn - DBI data source name (e.g.: dbi:mysql:racktables)

  • user - database user name

  • password - database password

Section [device:pdu]

  • formats - specify the formats associated with a PDU object as a space seperated list. Default is "Cacti Nagios"

Section [device:pdu:apc_rackpdu]

  • ftp_login - specify the FTP login; can be overridden with the --device-login option

  • ftp_password - specify the FTP password; can be overridden with the --device-password option

  • mail_address - specify the contact address for the device

  • write_community - specify the SNMP write community (needed to restart the device); can be overridden with the --write-community option

Section [device:server]

  • formats - specify the formats associated with a Server object as a space seperated list. Default is "DHCP PXE Kickstart Cacti Nagios Bacula"

Section [device:server:hp_proliant]

  • admin_password - (mandatory) specify the iLO password for the custom account "admin"; can be overridden with the --device-password option

  • ilo_password - (mandatory) specify the iLO password for the factory account "Administrator"

  • license_key - specify the license key

  • serial_cli_speed - specify the serial CLI speed; the value can be one of the following: 1 (9,600 bps), 2 (19,200 bps), 3 (38,400 bps), 4 (57,600 bps), 5 (115,200 bps).

Section [device:switch]

  • formats - specify the formats associated with a Switch object as a space seperated list. Default is "Cacti Nagios"

Section [device:switch:cisco_catalyst]

  • ios_password - specify the IOS access password; can be overridden with the --device-password option

  • enable_password - specify the IOS admin password

Section [format:bacula]

  • password - specify Bacula password

  • path - specify the location to store the generated files

Section [format:cacti]

  • path - specify the location of Cacti CLI programs

  • php - specify the path of the php(1) CLI interpreter

  • sudo_as - specify an optional user account to execute the Cacti programs under, using sudo(8)

Section [format:dhcp]

Section [format:kickstart]

Section [format:ldap]

  • path - specify the location to store the generated files

Section [format:nagios]

  • path - specify the location to store the generated files

Section [format:pxe]

AUTHOR

Sebastien Aperghis-Tramoni (sebastien@aperghis.net)