Skip to content

Commit

Permalink
Merge pull request #152 from jguiditta/juno_galera
Browse files Browse the repository at this point in the history
Update puppet-galera to latest master.
  • Loading branch information
xbezdick committed Nov 25, 2014
2 parents 89773d3 + 57795a8 commit 1459782
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 56 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod 'firewall',
:git => 'https://github.com/puppetlabs/puppetlabs-firewall.git'

mod 'galera',
:commit => 'a63ab112aabdc9faa5e66fc095ef9dcc865d6999',
:commit => 'f7d4110886b643eb63dc5c347a0e8a06b09642e7',
:git => 'https://github.com/rohara/puppet-galera.git'

mod 'glance',
Expand Down
11 changes: 0 additions & 11 deletions galera/Modulefile

This file was deleted.

27 changes: 14 additions & 13 deletions galera/manifests/monitor.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@
# }
#
class galera::monitor (
$mysql_username = 'monitor_user',
$mysql_password = 'monitor_pass',
$mysql_host = '127.0.0.1',
$mysql_port = '3306',
$monitor_port = '9200',
$monitor_script = '/usr/bin/clustercheck',
$enabled = true,
$mysql_username = 'monitor_user',
$mysql_password = 'monitor_pass',
$mysql_host = '127.0.0.1',
$mysql_port = '3306',
$monitor_port = '9200',
$monitor_script = '/usr/bin/clustercheck',
$enabled = true,
$create_mysql_user = false,
) {

Class['galera::server'] -> Class['galera::monitor']

if $enabled {
$monitor_disable = 'no'
} else {
Expand All @@ -57,9 +56,11 @@
log_on_failure_operator => '=',
}

database_user { "${mysql_username}@${mysql_host}":
ensure => present,
password_hash => mysql_password($mysql_password),
require => [File['/root/.my.cnf'],Service['galera']],
if $create_mysql_user {
mysql_user { "${mysql_username}@${mysql_host}":
ensure => present,
password_hash => mysql_password($mysql_password),
require => [File['/root/.my.cnf'],Service['galera']],
}
}
}
38 changes: 15 additions & 23 deletions galera/manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# manages the package, service, galera.cnf
#
# Parameters:
# [*config_hash*] - Hash of config parameters that need to be set.
# [*msyql_server_hash*] - Hash of mysql server parameters.
# [*bootstrap*] - Defaults to false, boolean to set cluster boostrap.
# [*package_name*] - The name of the galera package.
# [*package_ensure*] - Ensure state for package. Can be specified as version.
Expand Down Expand Up @@ -42,15 +42,13 @@
# }
#
class galera::server (
$config_hash = {},
$mysql_server_hash = {},
$bootstrap = false,
$debug = false,
$package_name = 'mariadb-galera-server',
$package_ensure = 'present',
$service_name = $mysql::params::service_name,
$service_name = 'mariadb',
$service_enable = true,
$service_ensure = 'running',
$service_provider = $mysql::params::service_provider,
$manage_service = false,
$wsrep_bind_address = '0.0.0.0',
$wsrep_node_address = undef,
$wsrep_provider = '/usr/lib64/galera/libgalera_smm.so',
Expand All @@ -62,16 +60,11 @@
$wsrep_ssl = false,
$wsrep_ssl_key = undef,
$wsrep_ssl_cert = undef,
) inherits mysql {
) {

$config_class = { 'mysql::config' => $config_hash }
$mysql_server_class = { 'mysql::server' => $mysql_server_hash }

create_resources( 'class', $config_class )

package { 'galera':
name => $package_name,
ensure => $package_ensure,
}
create_resources( 'class', $mysql_server_class )

$wsrep_provider_options = wsrep_options({
'socket.ssl' => $wsrep_ssl,
Expand All @@ -87,16 +80,15 @@
owner => 'root',
group => 'root',
content => template('galera/wsrep.cnf.erb'),
notify => Service['galera'],
notify => Service[$service_name],
}

Service['galera'] -> Exec<| title == 'set_mysql_rootpw' |>

service { 'galera':
name => $service_name,
enable => $service_enable,
ensure => $service_ensure,
require => Package['galera'],
provider => $service_provider,
if $manage_service {
service { 'galera':
name => $service_name,
name => 'mysqld', # short-term hack to see if it works
enable => $service_enable,
ensure => $service_ensure,
}
}
}
51 changes: 51 additions & 0 deletions galera/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "puppet-galera",
"version": "0.0.2",
"author": "Ryan O\'Hara",
"summary": "Install/Configure MariaDB with galera",
"license": "Apache 2.0",
"source": "git://github.com/redhat-openstack/puppet-galera.git",
"project_page": "https://github.com/redhat-openstack/puppet-galera",
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
{
"operatingsystem": "Scientific",
"operatingsystemrelease": [
"5",
"6",
"7"
]
},
],
"requirements": [
{
"name": "pe",
"version_requirement": "3.x"
},
{
"name": "puppet",
"version_requirement": "3.x"
}
],
"description": "Install/Configure MariaDB with Galera",
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0"},
{"name":"puppetlabs/mysql","version_requirement":">= 2.3.1"},
{"name":"puppetlabs/xinetd","version_requirement":">= 1.2.0"}
]
}
12 changes: 4 additions & 8 deletions galera/templates/wsrep.cnf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ innodb_autoinc_lock_mode=2
innodb_locks_unsafe_for_binlog=1

# Query Cache is not supported with wsrep
query_cache_size=0
#### query_cache_size=0 now in server.cnf
query_cache_type=0

# Override bind-address
Expand All @@ -46,13 +46,6 @@ wsrep_provider_options="<%= @wsrep_provider_options.join '; ' %>"
# Logical cluster name. Should be the same for all nodes.
wsrep_cluster_name="<%= @wsrep_cluster_name %>"

# Group communication system handle
<% if @bootstrap -%>
wsrep_cluster_address="gcomm://"
<% elsif !@wsrep_cluster_members.empty? -%>
wsrep_cluster_address="gcomm://<%= @wsrep_cluster_members.join ',' %>"
<% end -%>

# Human-readable node name (non-unique). Hostname by default.
#wsrep_node_name=

Expand Down Expand Up @@ -125,6 +118,7 @@ wsrep_sst_method=<%= @wsrep_sst_method %>

# SST authentication string. This will be used to send SST to joining nodes.
# Depends on SST method. For mysqldump method it is root:<root password>
# Below is ignored if using rsync for wsrep_sst_method
wsrep_sst_auth=<%= @wsrep_sst_username %>:<%= @wsrep_sst_password %>

# Desired SST donor name.
Expand All @@ -135,3 +129,5 @@ wsrep_sst_auth=<%= @wsrep_sst_username %>:<%= @wsrep_sst_password %>

# Protocol version to use
# wsrep_protocol_version=

skip-name-resolve=1

0 comments on commit 1459782

Please sign in to comment.