class ikiwiki { package { "ikiwiki": ensure => installed, } case $apache_sites_folder { '': { fail("you need to define \$apache_sites_folder for ikiwiki module") } } file { "/usr/local/sbin/ikiwiki-deploy": ensure => present, content => template('ikiwiki/deploy.sh.erb'), owner => root, group => root, mode => 755, } file { "/usr/local/sbin/ikiwiki-refresh": ensure => present, content => template('ikiwiki/refresh.sh.erb'), owner => root, group => root, mode => 755, } define instance($base_url = $domain, $ensure = 'present', $description = false, $adminuser = 'yourname', $adminemail = 'me@example.org', $instance = 'ikiwiki', $account_creation_password = false, $add_plugins = false, $disable_plugins = false) { $desc = $description ? { false => $title, default => $description, } case $ensure { 'present': { file { "/etc/ikiwiki/$name.setup": ensure => present, content => template('ikiwiki/ikiwiki.setup.erb'), owner => root, group => root, mode => 644, notify => Exec["ikiwiki_refresh_${name}"], } exec { "ikiwiki_refresh_${name}": command => "/usr/local/sbin/ikiwiki-refresh $name $instance", user => root, refreshonly => true, } exec { "/usr/local/sbin/ikiwiki-deploy $name $instance": unless => "/bin/sh -c '[ -f ${apache_sites_folder}/${name}/${instance}_src/index.mdwn ]'", user => root, } if !defined(File["${apache_sites_folder}/${name}/${instance}_src"]) { file { "${apache_sites_folder}/${name}/${instance}_src": ensure => directory, owner => www-data, group => www-data, recurse => true, notify => Exec["ikiwiki_refresh_${name}"], require => File["${apache_sites_folder}/${name}"], } } if !defined(File["${apache_sites_folder}/${name}/${instance}"]) { file { "${apache_sites_folder}/${name}/${instance}": ensure => directory, owner => www-data, group => www-data, recurse => true, require => File["${apache_sites_folder}/${name}"], } } if !defined(File["${apache_sites_folder}/${name}"]) { file { "${apache_sites_folder}/${name}": ensure => directory, owner => root, group => root, } } # The post-update hook should have www-data as owner so # gitosis can do a setuid to it and write to ikiwiki # folders without messing the permission scheme. # # The same is valid for the cgi. # # See http://ikiwiki.info/rcs/git/ # http://ikiwiki.info/forum/multi-user_setup_of_ikiwiki__44___gitosis_and_apache2_in_Debian_Sid/ # file { [ "/var/git/repositories/${name}.git/hooks/post-update", "${apache_sites_folder}/${name}/${instance}/ikiwiki.cgi" ]: ensure => present, owner => www-data, group => gitosis, mode => 6550, } } 'absent': { file { "/etc/ikiwiki/$name.setup": ensure => absent, } } } } }