define ikiwiki::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, $protocol = 'https', $owner = $name, $group = $name, $home = "/home/$name") { $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 => $owner, mode => 640, notify => Exec["ikiwiki_refresh_${name}_${instance}"], } exec { "ikiwiki_refresh_${name}_${instance}": command => "/usr/local/sbin/ikiwiki-refresh $name $instance $owner $group", user => root, refreshonly => true, } exec { "ssh-keygen-ikiwiki-${name}_${instance}": command => "ssh-keygen -t rsa -P '' -f ${home}/.ssh/id_rsa", creates => "${home}/.ssh/id_rsa", user => $owner, group => $group, require => File["${home}/.ssh"], } if !defined(File["${ikiwiki::sites_folder}/${name}/${instance}_src"]) { file { "${ikiwiki::sites_folder}/${name}/${instance}_src": ensure => directory, owner => $owner, group => $group, recurse => true, notify => Exec["ikiwiki_refresh_${name}_${instance}"], require => File["${ikiwiki::sites_folder}/${name}"], } } if !defined(File["${ikiwiki::sites_folder}/${name}/${instance}"]) { file { "${ikiwiki::sites_folder}/${name}/${instance}": ensure => directory, owner => $owner, group => $group, recurse => true, require => File["${ikiwiki::sites_folder}/${name}"], } } if !defined(File["${home}/.ssh"]) { file { "${home}/.ssh": ensure => directory, owner => $owner, group => $group, mode => 0700, } } if !defined(File["${ikiwiki::sites_folder}/${name}"]) { file { "${ikiwiki::sites_folder}/${name}": ensure => directory, owner => root, group => root, } } # See http://rtime.felk.cvut.cz/~sojka/blog/using-ikiwiki-with-gitolite/ file { "/var/git/repositories/${name}.git/hooks/post-update": ensure => present, owner => $owner, group => $ikiwiki::git_implementation, mode => 6550, require => File["/etc/ikiwiki/$name.setup"], } file { "${ikiwiki::sites_folder}/${name}/${instance}/ikiwiki.cgi": ensure => present, owner => $owner, group => $group, mode => 0550, require => File["/etc/ikiwiki/$name.setup"], } } 'absent': { file { "/etc/ikiwiki/$name.setup": ensure => absent, } } } }