fuel-library/deployment/puppet/osnailyfacter/manifests/mysql_root.pp
Mykyta Koshykov 906eb4217b Refactor DB creation
- Move DB creation for every service to own task
- Refactor Murano and Sahara DB configuration classes
- Cherry-pick MySQL providers from upstream to allow DB creation and
  management on remote host
- Remove openstack::db::mysql
- Move database and user creation to a separete task
- Either install local database or use an external one

Implements: blueprint: detach-components-from-controllers

Co-Authored-By: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
Co-Authored-By: Dmitry Ilyin <dilyin@mirantis.com>

Change-Id: Iaf3b7913e8c79c08025dbdaf5f2beff7337ab644
Signed-off-by: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
2015-07-02 17:51:21 +02:00

42 lines
1.0 KiB
Puppet

# == Class osnailyfacter::mysql_root
#
# Class for root grant permissions
#
# [*password*]
# Password to use with root user
#
class osnailyfacter::mysql_root (
$password = '',
) {
Exec {
path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
creates => '/root/.my.cnf',
}
exec { 'mysql_drop_test' :
command => "mysql -NBe \"drop database if exists test\"",
} ->
exec { 'mysql_root_%' :
command => "mysql -NBe \"grant all on *.* to 'root'@'%' with grant option\"",
} ->
exec { 'mysql_root_localhost' :
command => "mysql -NBe \"grant all on *.* to 'root'@'localhost' with grant option\"",
} ->
exec { 'mysql_root_127.0.0.1' :
command => "mysql -NBe \"grant all on *.* to 'root'@'127.0.0.1' with grant option\"",
} ->
exec { 'mysql_root_password' :
command => "mysql -NBe \"update mysql.user set password = password('${password}') where user = 'root'\"",
} ->
exec { 'mysql_flush_privileges' :
command => "mysql -NBe \"flush privileges\"",
}
}