1 |
misc |
1735 |
class mediawiki { |
2 |
boklm |
2032 |
class config($pgsql_password, $secretkey, $ldap_password) { |
3 |
|
|
} |
4 |
|
|
|
5 |
misc |
1735 |
class base { |
6 |
misc |
1739 |
|
7 |
|
|
$root = "/srv/wiki/" |
8 |
|
|
|
9 |
|
|
include apache::mod_php |
10 |
|
|
|
11 |
misc |
1769 |
package { ['mediawiki-minimal','mediawiki-ldapauthentication'] : |
12 |
misc |
1735 |
ensure => installed, |
13 |
|
|
} |
14 |
misc |
1739 |
|
15 |
|
|
file { $root: |
16 |
|
|
ensure => directory, |
17 |
|
|
} |
18 |
misc |
1750 |
|
19 |
|
|
file { "/usr/local/bin/init_wiki.php": |
20 |
|
|
ensure => present, |
21 |
|
|
owner => root, |
22 |
|
|
group => root, |
23 |
|
|
mode => 755, |
24 |
|
|
source => 'puppet:///modules/mediawiki/init_wiki.php', |
25 |
|
|
} |
26 |
|
|
|
27 |
misc |
1739 |
$user = "mediawiki" |
28 |
|
|
|
29 |
misc |
1752 |
postgresql::remote_user { $user: |
30 |
boklm |
2032 |
password => $config::pgsql_password, |
31 |
misc |
1735 |
} |
32 |
|
|
|
33 |
|
|
# TODO create the ldap user |
34 |
|
|
|
35 |
|
|
# TODO write the web configuration |
36 |
misc |
1739 |
apache::vhost_base { "wiki.$domain": |
37 |
|
|
location => $root, |
38 |
|
|
content => template("mediawiki/wiki_vhost.conf"), |
39 |
|
|
} |
40 |
misc |
1735 |
|
41 |
misc |
1739 |
apache::vhost_base { "ssl_wiki.$domain": |
42 |
|
|
location => $root, |
43 |
|
|
use_ssl => true, |
44 |
|
|
vhost => "wiki.$domain", |
45 |
|
|
content => template("mediawiki/wiki_vhost.conf"), |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
misc |
1735 |
# add index.php |
51 |
|
|
} |
52 |
|
|
|
53 |
|
|
# do wiki basic installation |
54 |
|
|
|
55 |
misc |
1739 |
define instance($title) { |
56 |
|
|
|
57 |
|
|
include mediawiki::base |
58 |
|
|
|
59 |
|
|
$path = $name |
60 |
|
|
$lang = $name |
61 |
|
|
$wiki_root = "$mediawiki::base::root/$path" |
62 |
|
|
$db_name = "mediawiki_$name" |
63 |
|
|
$db_user = "$mediawiki::base::user" |
64 |
boklm |
2032 |
$db_password = "$mediawiki::config::pgsql_password" |
65 |
|
|
$secret_key = "$mediawiki::config::secretkey" |
66 |
misc |
1739 |
|
67 |
|
|
file { "$wiki_root": |
68 |
|
|
ensure => directory |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
exec { "wikicreate $name": |
72 |
|
|
command => "mediawiki-create $wiki_root", |
73 |
|
|
cwd => "$mediawiki::base::root", |
74 |
|
|
require => [File["$wiki_root"],Package['mediawiki-minimal']], |
75 |
|
|
creates => "$wiki_root/index.php", |
76 |
|
|
} |
77 |
|
|
|
78 |
misc |
1753 |
postgresql::remote_database { "$db_name": |
79 |
misc |
1739 |
user => $db_user, |
80 |
misc |
1751 |
callback_notify => Exec["deploy_db $name"], |
81 |
misc |
1739 |
} |
82 |
|
|
|
83 |
misc |
1751 |
exec { "deploy_db $name": |
84 |
misc |
1754 |
command => "php /usr/local/bin/init_wiki.php $wiki_root", |
85 |
misc |
1751 |
refreshonly => true, |
86 |
|
|
onlyif => "test -d $wiki_root/config", |
87 |
|
|
} |
88 |
boklm |
2032 |
$ldap_password = $config::ldap_password |
89 |
misc |
1751 |
|
90 |
misc |
1739 |
file { "$wiki_root/LocalSettings.php": |
91 |
|
|
ensure => present, |
92 |
misc |
1774 |
content => template("mediawiki/LocalSettings.php"), |
93 |
|
|
# if LocalSettings is created first, the wikicreate script |
94 |
|
|
# do not create a confg directory, and so it doesn't trigger deploy_db exec |
95 |
|
|
require => Exec["wikicreate $name"], |
96 |
misc |
1739 |
} |
97 |
misc |
1735 |
} |
98 |
|
|
} |