diff options
Diffstat (limited to 'manifests/instance.pp')
-rw-r--r-- | manifests/instance.pp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/manifests/instance.pp b/manifests/instance.pp new file mode 100644 index 0000000..3c76365 --- /dev/null +++ b/manifests/instance.pp @@ -0,0 +1,81 @@ +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') { + + $desc = $description ? { + false => $title, + default => $description, + } + + case $ensure { + 'present': { + file { "/etc/ikiwiki/$name.setup": + ensure => present, + content => template('ikiwiki/ikiwiki.setup.erb'), + owner => www-data, + group => www-data, + mode => 640, + notify => Exec["ikiwiki_refresh_${name}"], + } + + exec { "ikiwiki_refresh_${name}": + command => "/usr/local/sbin/ikiwiki-refresh $name $instance", + user => root, + refreshonly => true, + } + + if !defined(File["${ikiwiki::sites_folder}/${name}/${instance}_src"]) { + file { "${ikiwiki::sites_folder}/${name}/${instance}_src": + ensure => directory, + owner => www-data, + group => www-data, + recurse => true, + notify => Exec["ikiwiki_refresh_${name}"], + require => File["${ikiwiki::sites_folder}/${name}"], + } + } + + if !defined(File["${ikiwiki::sites_folder}/${name}/${instance}"]) { + file { "${ikiwiki::sites_folder}/${name}/${instance}": + ensure => directory, + owner => www-data, + group => www-data, + recurse => true, + require => File["${ikiwiki::sites_folder}/${name}"], + } + } + + if !defined(File["${ikiwiki::sites_folder}/${name}"]) { + file { "${ikiwiki::sites_folder}/${name}": + ensure => directory, + owner => root, + group => root, + } + } + + # The post-update hook should have www-data as owner so + # gitolite 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___gitolite_and_apache2_in_Debian_Sid/ + # + file { [ "/var/git/repositories/${name}.git/hooks/post-update", + "${ikiwiki::sites_folder}/${name}/${instance}/ikiwiki.cgi" ]: + ensure => present, + owner => www-data, + group => gitolite, + mode => 6550, + require => File["/etc/ikiwiki/$name.setup"], + } + } + 'absent': { + file { "/etc/ikiwiki/$name.setup": + ensure => absent, + } + } + } +} |