system-config/modules/etherpad_lite/manifests/mysql.pp
Matthew Wagoner 7390450969 Cleanup etherpad_lite manifest lint errors.
Also, seperate out the buildsource defined resource from init.pp

Change-Id: I9fe46ad31943f667ebe8bb6b01a2007e0b3cf022
Reviewed-on: https://review.openstack.org/15061
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Paul Belanger <paul.belanger@polybeacon.com>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
2012-11-17 01:30:36 +00:00

83 lines
1.9 KiB
Puppet

# == Class: etherpad_lite::mysql
#
class etherpad_lite::mysql(
$database_password,
$dbType = 'mysql',
$database_user = 'eplite',
$database_name = 'etherpad-lite'
) {
include etherpad_lite
$base = "${etherpad_lite::base_install_dir}/etherpad-lite"
package { 'mysql-server':
ensure => present,
}
package { 'mysql-client':
ensure => present,
}
service { 'mysql':
ensure => running,
enable => true,
hasrestart => true,
require => [
Package['mysql-server'],
Package['mysql-client'],
],
}
file { "${base}/create_database.sh":
ensure => present,
content => template('etherpad_lite/create_database.sh.erb'),
group => $etherpad_lite::ep_user,
mode => '0755',
owner => $etherpad_lite::ep_user,
replace => true,
require => Class['etherpad_lite'],
}
file { "${base}/create_user.sh":
ensure => present,
content => template('etherpad_lite/create_user.sh.erb'),
group => $etherpad_lite::ep_user,
mode => '0755',
owner => $etherpad_lite::ep_user,
replace => true,
require => Class['etherpad_lite'],
}
exec { 'create-etherpad-lite-db':
unless => "mysql --defaults-file=/etc/mysql/debian.cnf ${database_name}",
path => [
'/bin',
'/usr/bin',
],
command => "${base}/create_database.sh",
require => [
Service['mysql'],
File["${base}/settings.json"],
File["${base}/create_database.sh"],
],
before => Exec['grant-etherpad-lite-db'],
}
exec { 'grant-etherpad-lite-db':
unless =>
"mysql -u${database_user} -p${database_password} ${database_name}",
path => [
'/bin',
'/usr/bin'
],
command => "${base}/create_user.sh",
require => [
Service['mysql'],
File["${base}/settings.json"],
File["${base}/create_user.sh"],
],
}
}
# vim:sw=2:ts=2:expandtab:textwidth=79