mediawiki.pp 5.9 KB
Newer Older
mh's avatar
mh committed
1
2
3
4
5
6
7
8
9
10
11
12
13
# domainalias:
#   - www: add as well a www.${name} entry
#   - absent: do nothing
#   - default: add the string
# user_provider:
#   - local: user will be crated locally (*default*)
#   - everything else will currently do noting
# run_mode:
#   - normal: nothing special (*default*)
#   - itk: apache is running with the itk module
#          and run_uid and run_gid are used as vhost users
# run_uid: the uid the vhost should run as with the itk module
# run_gid: the gid the vhost should run as with the itk module
mh's avatar
mh committed
14
15
16
17
18
19
# php_safe_mode_exec_bins: An array of local binaries which should be linked in the
#                          safe_mode_exec_bin for this hosting
#                          *default*: None
# php_default_charset: default charset header for php.
#                      *default*: absent, which will set the same as default_charset
#                                 of apache
mh's avatar
mh committed
20
21
22
23
24
25
#
# logmode:
#   - default: Do normal logging to CustomLog and ErrorLog
#   - nologs: Send every logging to /dev/null
#   - anonym: Don't log ips for CustomLog, send ErrorLog to /dev/null
#   - semianonym: Don't log ips for CustomLog, log normal ErrorLog
mh's avatar
mh committed
26
define webhosting::php::mediawiki(
mh's avatar
mh committed
27
28
    $ensure = present,
    $uid = 'absent',
mh's avatar
mh committed
29
    $uid_name = 'absent',
mh's avatar
mh committed
30
    $gid = 'uid',
31
    $gid_name = 'absent',
mh's avatar
mh committed
32
33
34
35
36
    $user_provider = 'local',
    $password = 'absent',
    $password_crypted = true,
    $domainalias = 'www',
    $server_admin = 'absent',
mh's avatar
mh committed
37
    $logmode = 'default',
mh's avatar
mh committed
38
39
40
41
42
43
44
45
46
47
48
49
    $owner = root,
    $group = 'sftponly',
    $run_mode = 'normal',
    $run_uid = 'absent',
    $run_uid_name = 'absent',
    $run_gid = 'absent',
    $run_gid_name = 'absent',
    $allow_override = 'FileInfo',
    $options = 'absent',
    $additional_options = 'absent',
    $default_charset = 'absent',
    $ssl_mode = false,
mh's avatar
mh committed
50
51
    $php_safe_mode_exec_bins = 'absent',
    $php_default_charset = 'absent',
mh's avatar
mh committed
52
53
54
55
56
57
    $vhost_mode = 'template',
    $vhost_source = 'absent',
    $vhost_destination = 'absent',
    $htpasswd_file = 'absent',
    $nagios_check = 'ensure',
    $nagios_check_domain = 'absent',
58
    $nagios_check_url = '/',
59
    $nagios_check_code = 'OK',
mh's avatar
mh committed
60
61
62
63
64
65
66
67
68
69
70
71
    $mod_security = true,
    $image = 'absent',
    $config = 'unmanaged',
    $db_server = 'unmanaged',
    $db_name = 'unmanaged',
    $db_user = 'unmanaged',
    $db_pwd = 'unmanaged',
    $contact = 'unmanaged',
    $sitename = 'unmanaged',
    $secret_key = 'unmanaged',
    $squid_servers = 'absent',
    $extensions = 'absent',
72
73
    $language = 'de',
    $hashed_upload_dir = true
mh's avatar
mh committed
74
){
mh's avatar
mh committed
75
76
77
78
79
    if ($uid_name == 'absent'){
      $real_uid_name = $name
    } else {
      $real_uid_name = $uid_name
    }
80
81
82
83
84
    if ($gid_name == 'absent'){
      $real_gid_name = $real_uid_name
    } else {
      $real_gid_name = $gid_name
    }
mh's avatar
mh committed
85
86
87
    webhosting::common{$name:
        ensure => $ensure,
        uid => $uid,
88
        uid_name => $real_uid_name,
mh's avatar
mh committed
89
        gid => $gid,
90
        gid_name => $real_gid_name,
mh's avatar
mh committed
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
        user_provider => $user_provider,
        password => $password,
        password_crypted => $password_crypted,
        htpasswd_file => $htpasswd_file,
        ssl_mode => $ssl_mode,
        run_mode => $run_mode,
        run_uid => $run_uid,
        run_uid_name => $run_uid_name,
        run_gid => $run_gid,
        nagios_check => $nagios_check,
        nagios_check_domain => $nagios_check_domain,
        nagios_check_url => $nagios_check_url,
        nagios_check_code => $nagios_check_code,
    }

    apache::vhost::php::mediawiki{"${name}":
        ensure => $ensure,
        domainalias => $domainalias,
        server_admin => $server_admin,
mh's avatar
mh committed
110
        logmode => $logmode,
mh's avatar
mh committed
111
112
113
114
115
116
117
118
        group => $group,
        manage_docroot => false,
        allow_override => $allow_override,
        options => $options,
        additional_options => $additional_options,
        default_charset => $default_charset,
        run_mode => $run_mode,
        ssl_mode => $ssl_mode,
mh's avatar
mh committed
119
120
        php_default_charset => $php_default_charset,
        php_safe_mode_exec_bins => $php_safe_mode_exec_bins,
mh's avatar
mh committed
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
        vhost_mode => $vhost_mode,
        vhost_source => $vhost_source,
        vhost_destination => $vhost_destination,
        htpasswd_file => $htpasswd_file,
        mod_security => $mod_security,
    }
    mediawiki::instance{$name:
      ensure => $ensure,
      image => $image,
      config => $config,
      db_server => $db_server,
      db_name => $db_name,
      db_user => $db_user,
      db_pwd => $db_pwd,
      contact => $contact,
      sitename => $sitename,
mh's avatar
mh committed
137
      secret_key => $secret_key,
mh's avatar
mh committed
138
139
140
      extensions => $extensions,
      squid_servers => $squid_servers,
      language => $language,
141
      hashed_upload_dir => $hashed_upload_dir,
mh's avatar
mh committed
142
143
144
145
146
147
148
149
150
151
      documentroot_write_mode => 0660,
    }

    if ($run_mode == 'itk') {
          if ($run_uid_name == 'absent'){
            $real_run_uid_name = "${name}_run"
          } else {
            $real_run_uid_name = $run_uid_name
          }
          if ($run_gid_name == 'absent'){
mh's avatar
mh committed
152
153
154
155
            $real_run_gid_name = $gid_name ? {
              'absent' => $name,
              default => $gid_name
            }
mh's avatar
mh committed
156
157
158
159
          } else {
            $real_run_gid_name = $run_gid_name
          }
          Apache::Vhost::Php::Mediawiki[$name]{
mh's avatar
mh committed
160
            documentroot_owner => $real_uid_name,
161
            documentroot_group => $real_gid_name,
mh's avatar
mh committed
162
163
            run_uid => $real_run_uid_name,
            run_gid => $real_run_gid_name,
mh's avatar
mh committed
164
            require => [ User::Sftp_only["${real_uid_name}"], User::Managed["${real_run_uid_name}"] ],
mh's avatar
mh committed
165
166
          }
          Mediawiki::Instance[$name]{
mh's avatar
mh committed
167
            documentroot_owner => $real_uid_name,
168
            documentroot_group => $real_gid_name,
mh's avatar
mh committed
169
            documentroot_mode => 0640,
mh's avatar
mh committed
170
            require => [ User::Sftp_only["${real_uid_name}"], User::Managed["${real_run_uid_name}"] ],
mh's avatar
mh committed
171
172
173
          }
    } else {
      Apache::Vhost::Php::Mediawiki[$name]{
mh's avatar
mh committed
174
        require => User::Sftp_only["${real_uid_name}"],
mh's avatar
mh committed
175
176
      }
      Mediawiki::Instance[$name]{
mh's avatar
mh committed
177
        require => User::Sftp_only["${real_uid_name}"],
mh's avatar
mh committed
178
179
180
181
      }
    }
}