Defined Type: nut::ups

Defined in:
manifests/ups.pp

Overview

Adds and configures a UPS.

Examples:

Adding a USB-connected Smart-UPS 1000i

include ::nut
::nut::ups { 'sua1000i':
  driver => 'usbhid-ups',
  port   => 'auto',
}

Parameters:

  • driver (String)

    The driver to use for this UPS.

  • port (Variant[Integer[0, 65535], String])

    The port or device name where the UPS is attached.

  • extra (Hash[String, Any]) (defaults to: {})

    Any additional driver-specific options can be passed here.

  • ups (String) (defaults to: $title)

    The name of the UPS.

See Also:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'manifests/ups.pp', line 17

define nut::ups (
  String                             $driver,
  Variant[Integer[0, 65535], String] $port,
  Hash[String, Any]                  $extra = {},
  String                             $ups   = $title,
) {

  if ! defined(Class['nut']) {
    fail('You must include the nut base class before using any nut defined resources')
  }

  ::concat::fragment { "nut ups ${ups}":
    content => template("${module_name}/ups.conf.erb"),
    target  => "${::nut::conf_dir}/ups.conf",
  }

  # Handle SNMP or XML UPS drivers
  if has_key($::nut::driver_packages, $driver) {
    ensure_packages([$::nut::driver_packages[$driver]])

    Package[$::nut::driver_packages[$driver]]
      -> ::Concat::Fragment["nut ups ${ups}"]
  }
}