aboutsummaryrefslogtreecommitdiffstats
path: root/modules/mediawiki
diff options
context:
space:
mode:
Diffstat (limited to 'modules/mediawiki')
-rw-r--r--modules/mediawiki/manifests/base.pp36
-rw-r--r--modules/mediawiki/manifests/config.pp12
-rw-r--r--modules/mediawiki/manifests/init.pp94
-rw-r--r--modules/mediawiki/manifests/instance.pp54
4 files changed, 97 insertions, 99 deletions
diff --git a/modules/mediawiki/manifests/base.pp b/modules/mediawiki/manifests/base.pp
new file mode 100644
index 00000000..bcc654af
--- /dev/null
+++ b/modules/mediawiki/manifests/base.pp
@@ -0,0 +1,36 @@
+class mediawiki::base {
+ include apache::mod_php
+ $vhost = $mediawiki::config::vhost
+ $root = $mediawiki::config::root
+
+ package { ['mediawiki-minimal','mediawiki-ldapauthentication']: }
+
+ file { $mediawiki::config::root:
+ ensure => directory,
+ }
+
+ file { '/usr/local/bin/init_wiki.php':
+ mode => '0755',
+ source => 'puppet:///modules/mediawiki/init_wiki.php',
+ }
+
+ $user = 'mediawiki'
+
+ postgresql::remote_user { $user:
+ password => $mediawiki::config::pgsql_password,
+ }
+
+ # TODO create the ldap user
+
+ if $vhost {
+ apache::vhost_redirect_ssl { $vhost: }
+
+ apache::vhost_base { "ssl_$vhost":
+ location => $root,
+ use_ssl => true,
+ vhost => $vhost,
+ content => template('mediawiki/wiki_vhost.conf'),
+ }
+ }
+ # add index.php
+}
diff --git a/modules/mediawiki/manifests/config.pp b/modules/mediawiki/manifests/config.pp
index 2ef7f766..1375ea0b 100644
--- a/modules/mediawiki/manifests/config.pp
+++ b/modules/mediawiki/manifests/config.pp
@@ -1,9 +1,9 @@
# the class is just here to handle global configuration
-# a smart variation of the method exposed on
+# a smart variation of the methods exposed on
# http://puppetlabs.com/blog/the-problem-with-separating-data-from-puppet-code/
class mediawiki::config(
- $pgsql_password,
- $secretkey,
- $ldap_password,
- $vhost = "wiki.$::domain",
- $root = '/srv/wiki/') {}
+ $pgsql_password,
+ $secretkey,
+ $ldap_password,
+ $vhost = "wiki.$::domain",
+ $root = '/srv/wiki/') {}
diff --git a/modules/mediawiki/manifests/init.pp b/modules/mediawiki/manifests/init.pp
index 60d932b1..28e79fab 100644
--- a/modules/mediawiki/manifests/init.pp
+++ b/modules/mediawiki/manifests/init.pp
@@ -1,93 +1 @@
-class mediawiki {
- class base inherits config {
-
- include apache::mod_php
-
- package { ['mediawiki-minimal','mediawiki-ldapauthentication']: }
-
- file { $root:
- ensure => directory,
- }
-
- file { "/usr/local/bin/init_wiki.php":
- mode => 755,
- source => 'puppet:///modules/mediawiki/init_wiki.php',
- }
-
- $user = "mediawiki"
-
- postgresql::remote_user { $user:
- password => sprintf('%s', $config::pgsql_password),
- }
-
- # TODO create the ldap user
-
- if $vhost {
- apache::vhost_redirect_ssl { $vhost: }
-
- apache::vhost_base { "ssl_$vhost":
- location => $root,
- use_ssl => true,
- vhost => $vhost,
- content => template("mediawiki/wiki_vhost.conf"),
- }
- }
-
-
-
- # add index.php
- }
-
- # do wiki basic installation
-
- define instance($title, $wiki_settings = '', $skinsdir = '/usr/share/mediawiki/skins') {
-
- include mediawiki::base
-
- $path = $name
- $lang = $name
- $wiki_root = "$mediawiki::base::root/$path"
- $db_name = "mediawiki_$name"
- $db_user = "$mediawiki::base::user"
- $db_password = "$mediawiki::config::pgsql_password"
- $secret_key = "$mediawiki::config::secretkey"
-
- file { "$wiki_root":
- ensure => directory
- }
-
- file { "$wiki_root/skins":
- ensure => link,
- target => $skinsdir,
- require => File["$wiki_root"],
- }
-
- exec { "wikicreate $name":
- command => "mediawiki-create $wiki_root",
- cwd => "$mediawiki::base::root",
- require => [File["$wiki_root"],Package['mediawiki-minimal']],
- creates => "$wiki_root/index.php",
- }
-
- postgresql::remote_database { "$db_name":
- user => $db_user,
- callback_notify => Exec["deploy_db $name"],
- }
-
- exec { "deploy_db $name":
- command => "php /usr/local/bin/init_wiki.php $wiki_root",
- refreshonly => true,
- onlyif => "test -d $wiki_root/config",
- }
- $ldap_password = $config::ldap_password
-
- file { "$wiki_root/LocalSettings.php":
- owner => apache,
- mode => 600,
- content => template("mediawiki/LocalSettings.php"),
- # if LocalSettings is created first, the wikicreate script
- # do not create a confg directory, and so it doesn't trigger deploy_db exec
- require => Exec["wikicreate $name"],
- }
- }
-}
+class mediawiki { }
diff --git a/modules/mediawiki/manifests/instance.pp b/modules/mediawiki/manifests/instance.pp
new file mode 100644
index 00000000..4800114a
--- /dev/null
+++ b/modules/mediawiki/manifests/instance.pp
@@ -0,0 +1,54 @@
+define mediawiki::instance( $title,
+ $wiki_settings = '',
+ $skinsdir = '/usr/share/mediawiki/skins') {
+
+ include mediawiki::base
+
+ $path = $name
+ $lang = $name
+ $wiki_root = "$mediawiki::base::root/$path"
+ $db_name = "mediawiki_$name"
+ $db_user = $mediawiki::base::user
+ $db_password = $mediawiki::config::pgsql_password
+ $secret_key = $mediawiki::config::secretkey
+ $ldap_password = $mediawiki::config::ldap_password
+
+ file { $wiki_root:
+ ensure => directory
+ }
+
+ file { "$wiki_root/skins":
+ ensure => link,
+ target => $skinsdir,
+ require => File[$wiki_root],
+ }
+
+ exec { "wikicreate $name":
+ command => "mediawiki-create $wiki_root",
+ cwd => $mediawiki::base::root,
+ require => [File[$wiki_root],Package['mediawiki-minimal']],
+ creates => "$wiki_root/index.php",
+ }
+
+ postgresql::remote_database { $db_name:
+ user => $db_user,
+ callback_notify => Exec["deploy_db $name"],
+ }
+
+ exec { "deploy_db $name":
+ command => "php /usr/local/bin/init_wiki.php $wiki_root",
+ refreshonly => true,
+ onlyif => "test -d $wiki_root/config",
+ }
+
+ file { "$wiki_root/LocalSettings.php":
+ owner => 'apache',
+ mode => '0600',
+ content => template('mediawiki/LocalSettings.php'),
+ # if LocalSettings is created first, the wikicreate script
+ # do not create a confg directory, and so it doesn't
+ # trigger deploy_db exec
+ require => Exec["wikicreate $name"],
+ }
+}
+