From a1f92c75e44453e7a85c2de7609bf80e1ed92b8c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 6 Jan 2010 22:44:37 -0200 Subject: Adding ensure into ikiwiki::instance --- manifests/init.pp | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 05707d7..1cef3e6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,30 +15,34 @@ class ikiwiki { mode => 755, } - define instance() { + define instance($ensure = 'present') { file { "/etc/ikiwiki/$name.setup": - ensure => present, + ensure => $ensure, content => template('ikiwiki/ikiwiki.setup.erb'), owner => root, group => root, mode => 644, } - exec { "ikiwiki --setup /etc/ikiwiki/$name.setup": - user => gitosis, - refreshonly => true, - } - - exec { "/usr/local/sbin/ikiwiki-deploy $name": - unless => "/bin/sh -c [ -f '${apache_sites_folder}/${name}_src/index.mdw' ]", - } - - file { [ "${apache_sites_folder}/${name}_src" ]: - ensure => directory, - owner => gitosis, - group => gitosis, - recurse => true, - notify => Exec["ikiwiki --setup /etc/ikiwiki/$name.setup"], + case $ensure { + 'present': { + exec { "ikiwiki --setup /etc/ikiwiki/$name.setup": + user => gitosis, + refreshonly => true, + } + + exec { "/usr/local/sbin/ikiwiki-deploy $name": + unless => "/bin/sh -c [ -f '${apache_sites_folder}/${name}_src/index.mdw' ]", + } + + file { [ "${apache_sites_folder}/${name}_src" ]: + ensure => directory, + owner => gitosis, + group => gitosis, + recurse => true, + notify => Exec["ikiwiki --setup /etc/ikiwiki/$name.setup"], + } + } } } } -- cgit v1.2.3