Puppet Class: ups

Defined in:
manifests/init.pp

Summary

Configure UPS monitoring

Overview

Parameters:

  • vendorid (String)

    sets the USB Vendor ID for the UPS

  • productid (String)

    sets the USB Product ID for the UPS



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'manifests/init.pp', line 5

class ups (
  String $vendorid,
  String $productid,
) {
  package { 'nut': }

  -> file { '/etc/udev/rules.d/50-ups.rules':
    ensure  => file,
    content => template('ups/udev.rules.erb'),
  }

  ~> exec { 'reload udev':
    command     => '/usr/bin/udevadm control --reload-rules',
    path        => '/usr/bin',
    refreshonly => true,
  }

  ~> exec { 'retrigger udev':
    command     => '/usr/bin/udevadm trigger',
    path        => '/usr/bin',
    refreshonly => true,
  }

  -> file { '/etc/nut/ups.conf':
    ensure  => file,
    content => template('ups/ups.conf.erb'),
  }

  ~> service { 'nut-driver@ups':
    ensure => running,
    enable => true,
  }

  ~> service { 'nut-server':
    ensure => running,
    enable => true,
  }
}