diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-01-03 14:51:53 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-01-03 14:51:53 -0200 |
commit | f1556ba8635f60d677dc64d2c765b679a5bf0758 (patch) | |
tree | 438f11572536b7ea05699f2c7226693b1cb36e3c /manifests | |
download | puppet-apcupsd-f1556ba8635f60d677dc64d2c765b679a5bf0758.tar.gz puppet-apcupsd-f1556ba8635f60d677dc64d2c765b679a5bf0758.tar.bz2 |
Initial import
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/init.pp | 49 |
1 files changed, 49 insertions, 0 deletions
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"] ], + } + } +} |