/[adm]/puppet/modules/mediawiki/manifests/init.pp
ViewVC logotype

Contents of /puppet/modules/mediawiki/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2034 - (show annotations) (download)
Wed Oct 12 18:29:38 2011 UTC (9 years, 11 months ago) by boklm
File size: 2731 byte(s)
use sprintf, to pass parameter as copy, and avoid problems with exported resource
1 class mediawiki {
2 class config($pgsql_password, $secretkey, $ldap_password) {
3 }
4
5 class base {
6
7 $root = "/srv/wiki/"
8
9 include apache::mod_php
10
11 package { ['mediawiki-minimal','mediawiki-ldapauthentication'] :
12 ensure => installed,
13 }
14
15 file { $root:
16 ensure => directory,
17 }
18
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 $user = "mediawiki"
28
29 postgresql::remote_user { $user:
30 password => sprintf('%s', $config::pgsql_password),
31 }
32
33 # TODO create the ldap user
34
35 # TODO write the web configuration
36 apache::vhost_base { "wiki.$domain":
37 location => $root,
38 content => template("mediawiki/wiki_vhost.conf"),
39 }
40
41 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 # add index.php
51 }
52
53 # do wiki basic installation
54
55 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 $db_password = "$mediawiki::config::pgsql_password"
65 $secret_key = "$mediawiki::config::secretkey"
66
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 postgresql::remote_database { "$db_name":
79 user => $db_user,
80 callback_notify => Exec["deploy_db $name"],
81 }
82
83 exec { "deploy_db $name":
84 command => "php /usr/local/bin/init_wiki.php $wiki_root",
85 refreshonly => true,
86 onlyif => "test -d $wiki_root/config",
87 }
88 $ldap_password = $config::ldap_password
89
90 file { "$wiki_root/LocalSettings.php":
91 ensure => present,
92 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 }
97 }
98 }

  ViewVC Help
Powered by ViewVC 1.1.28