Puppet Class: nut

Inherits:
nut::params
Defined in:
manifests/init.pp

Overview

Installs Network UPS Tools (NUT).

Examples:

Declaring the class

include ::nut

Listening on local subnet

class { '::nut':
  listen => [
    {
      'address' => $::ipaddress_eth0,
    },
    {
      'address' => $::ipaddress6_eth0,
    },
  ],
}

Parameters:

  • certfile (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Path to OpenSSL TLS certificate and key.

  • certident (Optional[Tuple[String, String]]) (defaults to: undef)

    Tuple of certificate name and NSS database password.

  • certpath (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    Path to NSS certificate database.

  • certrequest (Optional[Enum['no', 'request', 'require']]) (defaults to: undef)

    Client certificate authentication options for NSS.

  • client_certident (Optional[Tuple[String, String]]) (defaults to: undef)
  • client_certpath (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • client_certverify (Optional[Boolean]) (defaults to: undef)
  • client_cmdscript (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • client_deadtime (Optional[Integer[0]]) (defaults to: undef)
  • client_finaldelay (Optional[Integer[0]]) (defaults to: undef)
  • client_forcessl (Optional[Boolean]) (defaults to: undef)
  • client_hostsync (Optional[Integer[0]]) (defaults to: undef)
  • client_manage_package (Boolean) (defaults to: $::nut::params::client_manage_package)

    If the client is installed with the same package then set this to false.

  • client_manage_service (Boolean) (defaults to: $::nut::params::client_manage_service)

    If the client is started as part of the same service as the server then set this to false.

  • client_minsupplies (Integer[1]) (defaults to: 1)
  • client_nocommwarntime (Optional[Integer[0]]) (defaults to: undef)
  • client_use_upssched (Boolean) (defaults to: false)
  • client_notifycmd (Optional[Stdlib::Absolutepath]) (defaults to: $client_use_upssched)
  • client_notifyflag (Optional[Hash[Nut::Event, Tuple[Boolean, 3, 3]]]) (defaults to: undef)
  • client_notifymsg (Optional[Hash[Nut::Event, String]]) (defaults to: undef)
  • client_package_name (String) (defaults to: $::nut::params::client_package_name)
  • client_pollfreq (Optional[Integer[0]]) (defaults to: undef)
  • client_pollfreqalert (Optional[Integer[0]]) (defaults to: undef)
  • client_rbwarntime (Optional[Integer[0]]) (defaults to: undef)
  • client_service_name (String) (defaults to: $::nut::params::client_service_name)
  • client_shutdowncmd (String) (defaults to: $::nut::params::shutdown_command)
  • conf_dir (Stdlib::Absolutepath) (defaults to: $::nut::params::conf_dir)

    Top-level configuration directory, usually /etc/nut or /etc/ups.

  • driver_packages (Hash[String, String]) (defaults to: $::nut::params::driver_packages)

    Hash of driver types to the package that provides it.

  • group (String) (defaults to: $::nut::params::group)

    The unprivileged group used to drop root privileges.

  • listen (Optional[Array[Nut::Listen, 1]]) (defaults to: undef)

    An array of hashes of interface addresses to listen on, optionally with a port.

  • maxage (Optional[Integer[1]]) (defaults to: undef)

    Timeout for UPS drivers.

  • maxconn (Optional[Integer[1]]) (defaults to: undef)

    Maximum number of connections.

  • package_name (String) (defaults to: $::nut::params::server_package_name)

    The name of the package.

  • service_name (String) (defaults to: $::nut::params::server_service_name)

    Name of the service.

  • statepath (Stdlib::Absolutepath) (defaults to: $::nut::params::state_dir)

    Top-level state directory, usually /var/run/nut or /var/db/nut.

  • user (String) (defaults to: $::nut::params::user)

    The unprivileged user used to drop root privileges.

See Also:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'manifests/init.pp', line 65

class nut (
  Optional[Stdlib::Absolutepath]                   $certfile              = undef,
  Optional[Tuple[String, String]]                  $certident             = undef,
  Optional[Stdlib::Absolutepath]                   $certpath              = undef,
  Optional[Enum['no', 'request', 'require']]       $certrequest           = undef,
  Optional[Tuple[String, String]]                  $client_certident      = undef,
  Optional[Stdlib::Absolutepath]                   $client_certpath       = undef,
  Optional[Boolean]                                $client_certverify     = undef,
  Optional[Stdlib::Absolutepath]                   $client_cmdscript      = undef,
  Optional[Integer[0]]                             $client_deadtime       = undef,
  Optional[Integer[0]]                             $client_finaldelay     = undef,
  Optional[Boolean]                                $client_forcessl       = undef,
  Optional[Integer[0]]                             $client_hostsync       = undef,
  Boolean                                          $client_manage_package = $::nut::params::client_manage_package,
  Boolean                                          $client_manage_service = $::nut::params::client_manage_service,
  Integer[1]                                       $client_minsupplies    = 1,
  Optional[Integer[0]]                             $client_nocommwarntime = undef,
  Boolean                                          $client_use_upssched   = false,
  Optional[Stdlib::Absolutepath]                   $client_notifycmd      = $client_use_upssched ? {
    true    => $::nut::params::upssched, # lint:ignore:parameter_order
    default => undef,
  },
  Optional[Hash[Nut::Event, Tuple[Boolean, 3, 3]]] $client_notifyflag     = undef,
  Optional[Hash[Nut::Event, String]]               $client_notifymsg      = undef,
  String                                           $client_package_name   = $::nut::params::client_package_name,
  Optional[Integer[0]]                             $client_pollfreq       = undef,
  Optional[Integer[0]]                             $client_pollfreqalert  = undef,
  Optional[Integer[0]]                             $client_rbwarntime     = undef,
  String                                           $client_service_name   = $::nut::params::client_service_name,
  String                                           $client_shutdowncmd    = $::nut::params::shutdown_command,
  Stdlib::Absolutepath                             $conf_dir              = $::nut::params::conf_dir,
  Hash[String, String]                             $driver_packages       = $::nut::params::driver_packages,
  String                                           $group                 = $::nut::params::group,
  Optional[Array[Nut::Listen, 1]]                  $listen                = undef,
  Optional[Integer[1]]                             $maxage                = undef,
  Optional[Integer[1]]                             $maxconn               = undef,
  String                                           $package_name          = $::nut::params::server_package_name,
  String                                           $service_name          = $::nut::params::server_service_name,
  Stdlib::Absolutepath                             $statepath             = $::nut::params::state_dir,
  String                                           $user                  = $::nut::params::user,
) inherits nut::params {

  contain nut::install
  contain nut::config
  contain nut::service

  class { 'nut::common':
    certident      => $client_certident,
    certpath       => $client_certpath,
    certverify     => $client_certverify,
    cmdscript      => $client_cmdscript,
    conf_dir       => $conf_dir,
    deadtime       => $client_deadtime,
    finaldelay     => $client_finaldelay,
    forcessl       => $client_forcessl,
    group          => $group,
    hostsync       => $client_hostsync,
    manage_package => $client_manage_package,
    manage_service => $client_manage_service,
    minsupplies    => $client_minsupplies,
    nocommwarntime => $client_nocommwarntime,
    notifycmd      => $client_notifycmd,
    notifyflag     => $client_notifyflag,
    notifymsg      => $client_notifymsg,
    package_name   => $client_package_name,
    pollfreq       => $client_pollfreq,
    pollfreqalert  => $client_pollfreqalert,
    rbwarntime     => $client_rbwarntime,
    service_name   => $client_service_name,
    shutdowncmd    => $client_shutdowncmd,
    state_dir      => $statepath,
    use_upssched   => $client_use_upssched,
    user           => $user,
  }

  Class['nut::install'] -> Class['nut::config'] ~> Class['nut::service']

  if $client_manage_service {
    # If the client manages its own service then the client should depend on
    # the server being up
    Class['nut::service'] -> Class['nut::common']
  } else {
    # If the server service starts everything up then we need to have the
    # client configured before the service starts
    Class['nut::config'] -> Class['nut::common'] ~> Class['nut::service']
  }
}