system-config/modules/etherpad_lite/manifests/mysql.pp
Paul Belanger 13773cd105 More puppet-lint formatting fixes
Yet another bunch of puppet-lint fixes.

Change-Id: I9574cf1c5e35620b12e4d5e2bd6b2eb4d320c935
Signed-off-by: Paul Belanger <paul.belanger@polybeacon.com>
Reviewed-on: https://review.openstack.org/13988
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
2012-10-05 19:47:44 +00:00

77 lines
2.1 KiB
Puppet

class etherpad_lite::mysql(
$database_password,
$dbType = 'mysql',
$database_user = 'eplite',
$database_name = 'etherpad-lite'
) {
include 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 { "${etherpad_lite::base_install_dir}/etherpad-lite/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 { "${etherpad_lite::base_install_dir}/etherpad-lite/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 => "${etherpad_lite::base_install_dir}/etherpad-lite/create_database.sh",
require => [
Service['mysql'],
File["${etherpad_lite::base_install_dir}/etherpad-lite/settings.json"],
File["${etherpad_lite::base_install_dir}/etherpad-lite/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 => "${etherpad_lite::base_install_dir}/etherpad-lite/create_user.sh",
require => [
Service['mysql'],
File["${etherpad_lite::base_install_dir}/etherpad-lite/settings.json"],
File["${etherpad_lite::base_install_dir}/etherpad-lite/create_user.sh"]
],
}
}
# vim:sw=2:ts=2:expandtab:textwidth=79