aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/init.pp89
-rw-r--r--manifests/instance.pp81
2 files changed, 84 insertions, 86 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index e3972bd..061ee2e 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,12 +1,10 @@
-class ikiwiki {
+class ikiwiki(
+ $sites_folder = ${apache::sites_folder)
+) {
package { [ "ikiwiki", "po4a" ]:
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'),
@@ -23,85 +21,4 @@ class ikiwiki {
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,
- $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["${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
- # 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",
- "${apache_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,
- }
- }
- }
- }
}
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,
+ }
+ }
+ }
+}