Merge pull request #556 from enovance/feature/bump-mysql-2.2/sbadia

mysql: Un-pin Puppetlabs MySQL module, update for >= 2.2
This commit is contained in:
Emilien Macchi
2014-08-06 11:25:08 +02:00
13 changed files with 81 additions and 59 deletions

View File

@@ -74,7 +74,7 @@ fixtures:
ref: 'e3cc9a0ea895f6e01801e4620799c66c2337b7ed' ref: 'e3cc9a0ea895f6e01801e4620799c66c2337b7ed'
'mysql': 'mysql':
repo: 'git://github.com/enovance/puppetlabs-mysql.git' repo: 'git://github.com/enovance/puppetlabs-mysql.git'
ref: '11ab036fed3b252492f5400bf8fd69698d510482' ref: '8b814d4d2cb5786a15e8e37fb3b7444d5d5f0d3f'
'rabbitmq': 'rabbitmq':
repo: 'git://github.com/enovance/puppetlabs-rabbitmq' repo: 'git://github.com/enovance/puppetlabs-rabbitmq'
ref: '25420cb3c26c9a8432ab519d43c094d614d4fec4' ref: '25420cb3c26c9a8432ab519d43c094d614d4fec4'

View File

@@ -118,7 +118,7 @@ mod 'mongodb',
:ref => 'e3cc9a0ea895f6e01801e4620799c66c2337b7ed' :ref => 'e3cc9a0ea895f6e01801e4620799c66c2337b7ed'
mod 'mysql', mod 'mysql',
:git => 'git://github.com/enovance/puppetlabs-mysql.git', :git => 'git://github.com/enovance/puppetlabs-mysql.git',
:ref => '11ab036fed3b252492f5400bf8fd69698d510482' :ref => '8b814d4d2cb5786a15e8e37fb3b7444d5d5f0d3f'
mod 'ntp', mod 'ntp',
:git => 'git://github.com/enovance/puppetlabs-ntp.git', :git => 'git://github.com/enovance/puppetlabs-ntp.git',
:ref => 'eb02ba2937ce86fb609ae41499767244b78ec58d' :ref => 'eb02ba2937ce86fb609ae41499767244b78ec58d'

View File

@@ -114,6 +114,7 @@ class cloud::compute(
class { 'nova': class { 'nova':
database_connection => "mysql://${encoded_user}:${encoded_password}@${nova_db_host}/nova?charset=utf8", database_connection => "mysql://${encoded_user}:${encoded_password}@${nova_db_host}/nova?charset=utf8",
mysql_module => '2.2',
rabbit_userid => 'nova', rabbit_userid => 'nova',
rabbit_hosts => $rabbit_hosts, rabbit_hosts => $rabbit_hosts,
rabbit_password => $rabbit_password, rabbit_password => $rabbit_password,

View File

@@ -68,6 +68,7 @@ class cloud::database::dbaas(
class { 'trove': class { 'trove':
database_connection => "mysql://${encoded_user}:${encoded_password}@${trove_db_host}/trove?charset=utf8", database_connection => "mysql://${encoded_user}:${encoded_password}@${trove_db_host}/trove?charset=utf8",
mysql_module => '2.2',
rabbit_hosts => $rabbit_hosts, rabbit_hosts => $rabbit_hosts,
rabbit_password => $rabbit_password, rabbit_password => $rabbit_password,
rabbit_userid => 'trove', rabbit_userid => 'trove',

View File

@@ -21,7 +21,6 @@
# Array of internal ip of the galera nodes. # Array of internal ip of the galera nodes.
# Defaults to ['127.0.0.1'] # Defaults to ['127.0.0.1']
# #
class cloud::database::sql ( class cloud::database::sql (
$api_eth = '127.0.0.1', $api_eth = '127.0.0.1',
$service_provider = 'sysv', $service_provider = 'sysv',
@@ -74,14 +73,11 @@ class cloud::database::sql (
case $::osfamily { case $::osfamily {
'RedHat': { 'RedHat': {
class { 'mysql':
server_package_name => 'MariaDB-Galera-server',
client_package_name => 'MariaDB-client',
service_name => $mysql_service_name,
}
# Specific to Red Hat # Specific to Red Hat
$mysql_server_package_name = 'MariaDB-Galera-server'
$mysql_client_package_name = 'MariaDB-client'
$wsrep_provider = '/usr/lib64/galera/libgalera_smm.so' $wsrep_provider = '/usr/lib64/galera/libgalera_smm.so'
$mysql_server_config_file = '/etc/my.cnf'
$dirs = [ '/var/run/mysqld', '/var/log/mysql' ] $dirs = [ '/var/run/mysqld', '/var/log/mysql' ]
@@ -93,19 +89,15 @@ class cloud::database::sql (
} }
} # RedHat } # RedHat
'Debian': { 'Debian': {
class { 'mysql':
server_package_name => 'mariadb-galera-server',
client_package_name => 'mariadb-client',
service_name => $mysql_service_name,
}
# Specific to Debian / Ubuntu # Specific to Debian / Ubuntu
$mysql_server_package_name = 'mariadb-galera-server'
$mysql_client_package_name = 'mariadb-client'
$wsrep_provider = '/usr/lib/galera/libgalera_smm.so' $wsrep_provider = '/usr/lib/galera/libgalera_smm.so'
$mysql_server_config_file = '/etc/mysql/my.cnf'
database_user { 'debian-sys-maint@localhost': mysql_user { 'debian-sys-maint@localhost':
ensure => 'present', ensure => 'present',
password_hash => mysql_password($mysql_sys_maint_password), password_hash => mysql_password($mysql_sys_maint_password),
provider => 'mysql',
require => File['/root/.my.cnf'] require => File['/root/.my.cnf']
} }
@@ -155,18 +147,33 @@ class cloud::database::sql (
} }
class { 'mysql::server': class { 'mysql::server':
config_hash => { manage_config_file => false,
bind_address => $api_eth, config_file => $mysql_server_config_file,
root_password => $mysql_root_password, package_name => $mysql_server_package_name,
service_name => $mysql_service_name, service_name => $mysql_service_name,
}, override_options => { 'mysqld' => { 'bind-address' => $api_eth } },
notify => Service['xinetd'], root_password => $mysql_root_password,
notify => Service['xinetd'],
}
file { $mysql_server_config_file:
content => template('cloud/database/mysql.conf.erb'),
mode => '0644',
owner => 'root',
group => 'root',
notify => [Service['mysqld'],Exec['clean-mysql-binlog']],
require => Package['mysql-server'],
}
class { 'mysql::client':
package_name => $mysql_client_package_name,
} }
if $::hostname == $galera_master_name { if $::hostname == $galera_master_name {
# OpenStack DB # OpenStack DB
class { 'keystone::db::mysql': class { 'keystone::db::mysql':
mysql_module => '2.2',
dbname => 'keystone', dbname => 'keystone',
user => $keystone_db_user, user => $keystone_db_user,
password => $keystone_db_password, password => $keystone_db_password,
@@ -174,6 +181,7 @@ class cloud::database::sql (
allowed_hosts => $keystone_db_allowed_hosts, allowed_hosts => $keystone_db_allowed_hosts,
} }
class { 'glance::db::mysql': class { 'glance::db::mysql':
mysql_module => '2.2',
dbname => 'glance', dbname => 'glance',
user => $glance_db_user, user => $glance_db_user,
password => $glance_db_password, password => $glance_db_password,
@@ -181,6 +189,7 @@ class cloud::database::sql (
allowed_hosts => $glance_db_allowed_hosts, allowed_hosts => $glance_db_allowed_hosts,
} }
class { 'nova::db::mysql': class { 'nova::db::mysql':
mysql_module => '2.2',
dbname => 'nova', dbname => 'nova',
user => $nova_db_user, user => $nova_db_user,
password => $nova_db_password, password => $nova_db_password,
@@ -189,6 +198,7 @@ class cloud::database::sql (
} }
class { 'cinder::db::mysql': class { 'cinder::db::mysql':
mysql_module => '2.2',
dbname => 'cinder', dbname => 'cinder',
user => $cinder_db_user, user => $cinder_db_user,
password => $cinder_db_password, password => $cinder_db_password,
@@ -197,6 +207,7 @@ class cloud::database::sql (
} }
class { 'neutron::db::mysql': class { 'neutron::db::mysql':
mysql_module => '2.2',
dbname => 'neutron', dbname => 'neutron',
user => $neutron_db_user, user => $neutron_db_user,
password => $neutron_db_password, password => $neutron_db_password,
@@ -205,6 +216,7 @@ class cloud::database::sql (
} }
class { 'heat::db::mysql': class { 'heat::db::mysql':
mysql_module => '2.2',
dbname => 'heat', dbname => 'heat',
user => $heat_db_user, user => $heat_db_user,
password => $heat_db_password, password => $heat_db_password,
@@ -213,6 +225,7 @@ class cloud::database::sql (
} }
class { 'trove::db::mysql': class { 'trove::db::mysql':
mysql_module => '2.2',
dbname => 'trove', dbname => 'trove',
user => $trove_db_user, user => $trove_db_user,
password => $trove_db_password, password => $trove_db_password,
@@ -220,24 +233,21 @@ class cloud::database::sql (
allowed_hosts => $trove_db_allowed_hosts, allowed_hosts => $trove_db_allowed_hosts,
} }
# Monitoring DB
# Monitoring DB mysql_database { 'monitoring':
warning('Database mapping must be updated to puppetlabs/puppetlabs-mysql >= 2.x (see: https://dev.ring.enovance.com/redmine/issues/4510)')
database { 'monitoring':
ensure => 'present', ensure => 'present',
charset => 'utf8', charset => 'utf8',
collate => 'utf8_unicode_ci',
require => File['/root/.my.cnf'] require => File['/root/.my.cnf']
} }
database_user { "${galera_clustercheck_dbuser}@localhost": mysql_user { "${galera_clustercheck_dbuser}@localhost":
ensure => 'present', ensure => 'present',
# can not change password in clustercheck script # can not change password in clustercheck script
password_hash => mysql_password($galera_clustercheck_dbpassword), password_hash => mysql_password($galera_clustercheck_dbpassword),
provider => 'mysql',
require => File['/root/.my.cnf'] require => File['/root/.my.cnf']
} }
database_grant { "${galera_clustercheck_dbuser}@localhost/monitoring": mysql_grant { "${galera_clustercheck_dbuser}@localhost/monitoring":
privileges => ['all'] privileges => ['ALL']
} }
Database_user<<| |>> Database_user<<| |>>
@@ -277,7 +287,6 @@ class cloud::database::sql (
require => Service['xinetd'], require => Service['xinetd'],
} }
exec{'clean-mysql-binlog': exec{'clean-mysql-binlog':
# first sync take a long time # first sync take a long time
command => "/bin/bash -c '/usr/bin/mysqladmin --defaults-file=/root/.my.cnf shutdown ; /bin/rm ${::mysql::params::datadir}/ib_logfile*'", command => "/bin/bash -c '/usr/bin/mysqladmin --defaults-file=/root/.my.cnf shutdown ; /bin/rm ${::mysql::params::datadir}/ib_logfile*'",
@@ -291,13 +300,6 @@ class cloud::database::sql (
onlyif => "stat ${::mysql::params::datadir}/ib_logfile0 && test `du -sh ${::mysql::params::datadir}/ib_logfile0 | cut -f1` != '256M'", onlyif => "stat ${::mysql::params::datadir}/ib_logfile0 && test `du -sh ${::mysql::params::datadir}/ib_logfile0 | cut -f1` != '256M'",
} }
# TODO/WARNING(Gonéri): template changes do not trigger configuration changes
mysql::server::config{'basic_config':
notify_service => true,
notify => Exec['clean-mysql-binlog'],
settings => template('cloud/database/mysql.conf.erb')
}
@@haproxy::balancermember{$::fqdn: @@haproxy::balancermember{$::fqdn:
listening_service => 'galera_cluster', listening_service => 'galera_cluster',
server_names => $::hostname, server_names => $::hostname,

View File

@@ -350,7 +350,6 @@
# (optional) Amount of time a token should remain valid (in seconds) # (optional) Amount of time a token should remain valid (in seconds)
# Defaults to '3600' (1 hour) # Defaults to '3600' (1 hour)
# #
class cloud::identity ( class cloud::identity (
$swift_enabled = true, $swift_enabled = true,
$identity_roles_addons = ['SwiftOperator', 'ResellerAdmin'], $identity_roles_addons = ['SwiftOperator', 'ResellerAdmin'],
@@ -474,6 +473,7 @@ class cloud::identity (
idle_timeout => 60, idle_timeout => 60,
log_facility => $log_facility, log_facility => $log_facility,
sql_connection => "mysql://${encoded_user}:${encoded_password}@${keystone_db_host}/keystone?charset=utf8", sql_connection => "mysql://${encoded_user}:${encoded_password}@${keystone_db_host}/keystone?charset=utf8",
mysql_module => '2.2',
token_provider => 'keystone.token.providers.uuid.Provider', token_provider => 'keystone.token.providers.uuid.Provider',
use_syslog => $use_syslog, use_syslog => $use_syslog,
verbose => $verbose, verbose => $verbose,

View File

@@ -72,7 +72,6 @@
# Can be 'rbd' or 'file'. # Can be 'rbd' or 'file'.
# Defaults to 'rbd' to maintain backward compatibility # Defaults to 'rbd' to maintain backward compatibility
# #
class cloud::image::api( class cloud::image::api(
$glance_db_host = '127.0.0.1', $glance_db_host = '127.0.0.1',
$glance_db_user = 'glance', $glance_db_user = 'glance',
@@ -120,6 +119,7 @@ class cloud::image::api(
class { 'glance::api': class { 'glance::api':
database_connection => "mysql://${encoded_glance_user}:${encoded_glance_password}@${glance_db_host}/glance?charset=utf8", database_connection => "mysql://${encoded_glance_user}:${encoded_glance_password}@${glance_db_host}/glance?charset=utf8",
mysql_module => '2.2',
registry_host => $openstack_vip, registry_host => $openstack_vip,
registry_port => $ks_glance_registry_internal_port, registry_port => $ks_glance_registry_internal_port,
verbose => $verbose, verbose => $verbose,

View File

@@ -94,6 +94,7 @@ class cloud::image::registry(
class { 'glance::registry': class { 'glance::registry':
database_connection => "mysql://${encoded_glance_user}:${encoded_glance_password}@${glance_db_host}/glance?charset=utf8", database_connection => "mysql://${encoded_glance_user}:${encoded_glance_password}@${glance_db_host}/glance?charset=utf8",
mysql_module => '2.2',
verbose => $verbose, verbose => $verbose,
debug => $debug, debug => $debug,
auth_host => $ks_keystone_internal_host, auth_host => $ks_keystone_internal_host,

View File

@@ -46,6 +46,7 @@ class cloud::network::controller(
auth_protocol => $ks_keystone_admin_proto, auth_protocol => $ks_keystone_admin_proto,
auth_port => $ks_keystone_public_port, auth_port => $ks_keystone_public_port,
database_connection => "mysql://${encoded_user}:${encoded_password}@${neutron_db_host}/neutron?charset=utf8", database_connection => "mysql://${encoded_user}:${encoded_password}@${neutron_db_host}/neutron?charset=utf8",
mysql_module => '2.2',
api_workers => $::processorcount, api_workers => $::processorcount,
agent_down_time => '60', agent_down_time => '60',
} }

View File

@@ -137,6 +137,7 @@ class cloud::orchestration(
keystone_password => $ks_heat_password, keystone_password => $ks_heat_password,
auth_uri => "${ks_keystone_internal_proto}://${ks_keystone_internal_host}:${ks_keystone_internal_port}/v2.0", auth_uri => "${ks_keystone_internal_proto}://${ks_keystone_internal_host}:${ks_keystone_internal_port}/v2.0",
sql_connection => "mysql://${encoded_user}:${encoded_password}@${heat_db_host}/heat?charset=utf8", sql_connection => "mysql://${encoded_user}:${encoded_password}@${heat_db_host}/heat?charset=utf8",
mysql_module => '2.2',
rabbit_hosts => $rabbit_hosts, rabbit_hosts => $rabbit_hosts,
rabbit_password => $rabbit_password, rabbit_password => $rabbit_password,
rabbit_userid => 'heat', rabbit_userid => 'heat',

View File

@@ -32,6 +32,7 @@ class cloud::telemetry::api(
class { 'ceilometer::db': class { 'ceilometer::db':
database_connection => $db_conn, database_connection => $db_conn,
mysql_module => '2.2',
sync_db => true, sync_db => true,
require => Anchor['mongodb setup done'], require => Anchor['mongodb setup done'],
} }

View File

@@ -90,6 +90,7 @@ class cloud::volume(
class { 'cinder': class { 'cinder':
sql_connection => "mysql://${encoded_user}:${encoded_password}@${cinder_db_host}/cinder?charset=utf8", sql_connection => "mysql://${encoded_user}:${encoded_password}@${cinder_db_host}/cinder?charset=utf8",
mysql_module => '2.2',
rabbit_userid => 'cinder', rabbit_userid => 'cinder',
rabbit_hosts => $rabbit_hosts, rabbit_hosts => $rabbit_hosts,
rabbit_password => $rabbit_password, rabbit_password => $rabbit_password,

View File

@@ -69,16 +69,21 @@ describe 'cloud::database::sql' do
end end
it 'configure mysql galera server' do it 'configure mysql galera server' do
should contain_class('mysql').with( should contain_class('mysql::client').with(
:server_package_name => platform_params[:server_package_name], :package_name => platform_params[:mysql_client_package_name]
:client_package_name => platform_params[:client_package_name],
:service_name => 'mysql'
) )
should contain_class('mysql::server').with( should contain_class('mysql::server').with(
:config_hash => { 'bind_address' => '10.0.0.1', 'root_password' => params[:mysql_root_password], 'service_name' => 'mysql' }, :package_name => platform_params[:mysql_server_package_name],
:notify => 'Service[xinetd]' :root_password => params[:mysql_root_password],
:override_options => { 'mysqld' => { 'bind-address' => '10.0.0.1' } },
:notify => 'Service[xinetd]'
) )
should contain_file(platform_params[:mysql_server_config_file]).with_content(/^wsrep_cluster_name\s*= "galera_cluster"$/)
should contain_file(platform_params[:mysql_server_config_file]).with_content(/^wsrep_node_address\s*= "#{params[:api_eth]}"$/)
should contain_file(platform_params[:mysql_server_config_file]).with_content(/^wsrep_node_incoming_address\s*= "#{params[:api_eth]}"$/)
end # configure mysql galera server end # configure mysql galera server
context 'configure mysqlchk http replication' do context 'configure mysqlchk http replication' do
@@ -104,6 +109,7 @@ describe 'cloud::database::sql' do
it 'configure keystone database' do it 'configure keystone database' do
should contain_class('keystone::db::mysql').with( should contain_class('keystone::db::mysql').with(
:mysql_module => '2.2',
:dbname => 'keystone', :dbname => 'keystone',
:user => 'keystone', :user => 'keystone',
:password => 'secrete', :password => 'secrete',
@@ -113,6 +119,7 @@ describe 'cloud::database::sql' do
it 'configure glance database' do it 'configure glance database' do
should contain_class('glance::db::mysql').with( should contain_class('glance::db::mysql').with(
:mysql_module => '2.2',
:dbname => 'glance', :dbname => 'glance',
:user => 'glance', :user => 'glance',
:password => 'secrete', :password => 'secrete',
@@ -122,6 +129,7 @@ describe 'cloud::database::sql' do
it 'configure nova database' do it 'configure nova database' do
should contain_class('nova::db::mysql').with( should contain_class('nova::db::mysql').with(
:mysql_module => '2.2',
:dbname => 'nova', :dbname => 'nova',
:user => 'nova', :user => 'nova',
:password => 'secrete', :password => 'secrete',
@@ -131,6 +139,7 @@ describe 'cloud::database::sql' do
it 'configure cinder database' do it 'configure cinder database' do
should contain_class('cinder::db::mysql').with( should contain_class('cinder::db::mysql').with(
:mysql_module => '2.2',
:dbname => 'cinder', :dbname => 'cinder',
:user => 'cinder', :user => 'cinder',
:password => 'secrete', :password => 'secrete',
@@ -140,6 +149,7 @@ describe 'cloud::database::sql' do
it 'configure neutron database' do it 'configure neutron database' do
should contain_class('neutron::db::mysql').with( should contain_class('neutron::db::mysql').with(
:mysql_module => '2.2',
:dbname => 'neutron', :dbname => 'neutron',
:user => 'neutron', :user => 'neutron',
:password => 'secrete', :password => 'secrete',
@@ -149,6 +159,7 @@ describe 'cloud::database::sql' do
it 'configure heat database' do it 'configure heat database' do
should contain_class('heat::db::mysql').with( should contain_class('heat::db::mysql').with(
:mysql_module => '2.2',
:dbname => 'heat', :dbname => 'heat',
:user => 'heat', :user => 'heat',
:password => 'secrete', :password => 'secrete',
@@ -158,6 +169,7 @@ describe 'cloud::database::sql' do
it 'configure trove database' do it 'configure trove database' do
should contain_class('trove::db::mysql').with( should contain_class('trove::db::mysql').with(
:mysql_module => '2.2',
:dbname => 'trove', :dbname => 'trove',
:user => 'trove', :user => 'trove',
:password => 'secrete', :password => 'secrete',
@@ -166,17 +178,16 @@ describe 'cloud::database::sql' do
end end
it 'configure monitoring database' do it 'configure monitoring database' do
should contain_database('monitoring').with( should contain_mysql_database('monitoring').with(
:ensure => 'present', :ensure => 'present',
:charset => 'utf8' :charset => 'utf8'
) )
should contain_database_user("#{params[:galera_clustercheck_dbuser]}@localhost").with( should contain_mysql_user("#{params[:galera_clustercheck_dbuser]}@localhost").with(
:ensure => 'present', :ensure => 'present',
:password_hash => '*FDC68394456829A7344C2E9D4CDFD43DCE2EFD8F', :password_hash => '*FDC68394456829A7344C2E9D4CDFD43DCE2EFD8F'
:provider => 'mysql'
) )
should contain_database_grant("#{params[:galera_clustercheck_dbuser]}@localhost/monitoring").with( should contain_mysql_grant("#{params[:galera_clustercheck_dbuser]}@localhost/monitoring").with(
:privileges => 'all' :privileges => 'ALL'
) )
end # configure monitoring database end # configure monitoring database
end # configure databases on the galera master server end # configure databases on the galera master server
@@ -188,8 +199,9 @@ describe 'cloud::database::sql' do
end end
let :platform_params do let :platform_params do
{ :server_package_name => 'mariadb-galera-server', { :mysql_server_package_name => 'mariadb-galera-server',
:client_package_name => 'mariadb-client', :mysql_client_package_name => 'mariadb-client',
:mysql_server_config_file => '/etc/mysql/my.cnf',
:wsrep_provider => '/usr/lib/galera/libgalera_smm.so' } :wsrep_provider => '/usr/lib/galera/libgalera_smm.so' }
end end
@@ -202,8 +214,9 @@ describe 'cloud::database::sql' do
end end
let :platform_params do let :platform_params do
{ :server_package_name => 'MariaDB-Galera-server', { :mysql_server_package_name => 'MariaDB-Galera-server',
:client_package_name => 'MariaDB-client', :mysql_client_package_name => 'MariaDB-client',
:mysql_server_config_file => '/etc/my.cnf',
:wsrep_provider => '/usr/lib64/galera/libgalera_smm.so' } :wsrep_provider => '/usr/lib64/galera/libgalera_smm.so' }
end end