Puppet Class: mediawiki
- Inherits:
- mediawiki::params
- Defined in:
- manifests/init.pp
Overview
[View source]
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'manifests/init.pp', line 81
class mediawiki (
$server_name,
$admin_email,
$db_root_password,
$doc_root = $mediawiki::params::doc_root,
$tarball_url = $mediawiki::params::tarball_url,
$package_ensure = 'latest',
$max_memory = '2048'
) inherits mediawiki::params {
$web_dir = $mediawiki::params::web_dir
# Parse the url
$tarball_dir = regsubst($tarball_url, '^.*?/(\d\.\d+).*$', '\1')
$tarball_name = regsubst($tarball_url, '^.*?/(mediawiki-\d\.\d+.*tar\.gz)$', '\1')
$mediawiki_dir = regsubst($tarball_url, '^.*?/(mediawiki-\d\.\d+\.\d+).*$', '\1')
$mediawiki_install_path = "${web_dir}/${mediawiki_dir}"
# Specify dependencies
Class['mysql::server'] -> Class['mediawiki']
#Class['mysql::config'] -> Class['mediawiki']
class { 'apache':
mpm_module => 'prefork',
}
class { 'apache::mod::php': }
# Manages the mysql server package and service by default
class { 'mysql::server':
root_password => $db_root_password,
}
package { $mediawiki::params::packages:
ensure => $package_ensure,
}
Package[$mediawiki::params::packages] ~> Service<| title == $mediawiki::params::apache |>
# Make sure the directories and files common for all instances are included
file { 'mediawiki_conf_dir':
ensure => 'directory',
path => $mediawiki::params::conf_dir,
owner => 'apache',
group => 'apache',
mode => '0755',
require => Package[$mediawiki::params::packages],
}
# Download and install MediaWiki from a tarball
exec { "get-mediawiki":
cwd => $web_dir,
command => "/usr/bin/wget ${tarball_url}",
creates => "${web_dir}/${tarball_name}",
subscribe => File['mediawiki_conf_dir'],
}
exec { "unpack-mediawiki":
cwd => $web_dir,
command => "/bin/tar -xvzf ${tarball_name}",
creates => $mediawiki_install_path,
subscribe => Exec['get-mediawiki'],
}
class { 'memcached':
max_memory => $max_memory,
max_connections => '1024',
}
}
|