From f1556ba8635f60d677dc64d2c765b679a5bf0758 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 3 Jan 2010 14:51:53 -0200 Subject: Initial import --- manifests/init.pp | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 manifests/init.pp (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..660bda9 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,49 @@ +class apcupsd { + package { "apcupsd": + ensure => installed, + } + + define ups($type = 'apcsmart', $cable = 'smart', $device = '/dev/ttyS0', $ensure = 'present') { + + $ups_configured = $ensure ? { + 'present' => 'yes', + 'absent' => 'no', + } + + $ups_state = $ensure ? { + 'present' => 'running', + 'absent' => 'stopped', + } + + file { "/etc/apcupsd": + ensure => 'directory', + owner => 'root', + group => 'root', + mode => 755, + } + + file { "/etc/apcupsd/apcupsd.conf": + ensure => present, + owner => root, + group => root, + mode => 644, + require => File["/etc/apcupsd"], + content => template('apcupsd/apcupsd.conf.erb'), + } + + file { "/etc/default/apcupsd": + ensure => present, + owner => root, + group => root, + mode => 644, + content => template('apcupsd/default/apcupsd.erb'), + } + + service { "apcupsd": + enable => true, + ensure => $ups_state, + hasrestart => true, + require => [ File["/etc/apcupsd/apcupsd.conf"], Package["apcupsd"] ], + } + } +} -- cgit v1.2.3