diff options
Diffstat (limited to 'manifests/subsystems/ups.pp')
-rw-r--r-- | manifests/subsystems/ups.pp | 62 |
1 files changed, 20 insertions, 42 deletions
diff --git a/manifests/subsystems/ups.pp b/manifests/subsystems/ups.pp index cc6677e..47b9f13 100644 --- a/manifests/subsystems/ups.pp +++ b/manifests/subsystems/ups.pp @@ -1,47 +1,25 @@ -class ups { - case $ups_type { - '': { $ups_type = 'usb' } - } - - case $ups_cable { - '': { $ups_cable = 'usb' } - } - - case $ups_dev { - '': { $ups_dev = '/dev/usb/hiddev0' } - } - - case $ups_nisip { - '': { $ups_nisip = '127.0.0.1' } - } - - case $ups_polltime { - '': { $ups_polltime = '60' } - } - - case $ups_onbatterydelay { - '': { $ups_onbatterydelay = '6' } - } - - case $ups_batterylevel { - '': { $ups_batterylevel = '5' } - } - - case $ups_minutes { - '': { $ups_minutes = '3' } - } - - case $has_ups { +class ups( + $include = hiera('nodo::ups::include', false), + $type = hiera('nodo::ups::type', 'usb'), + $cable = hiera('nodo::ups::cable', 'usb'), + $dev = hiera('nodo::ups::dev', '/dev/usb/hiddev0'), + $nisip = hiera('nodo::ups::nisip', '127.0.0.1'), + $polltime = hiera('nodo::ups::polltime', '60'), + $onbatterydelay = hiera('nodo::ups::onbatterydelay', '6'), + $batterylevel = hiera('nodo::ups::batterylevel', '5'), + $minutes = hiera('nodo::ups::minutes', '3' +) { + case $include { true: { class { "apcupsd": - upstype => $ups_type, - cable => $ups_cable, - device => $ups_dev, - nisip => $ups_nisip, - polltime => $ups_polltime, - onbatterydelay => $ups_onbatterydelay, - batterylevel => $ups_batterylevel, - minutes => $ups_minutes, + upstype => $type, + cable => $cable, + device => $dev, + nisip => $nisip, + polltime => $polltime, + onbatterydelay => $onbatterydelay, + batterylevel => $batterylevel, + minutes => $minutes, } } } |