Skip to content

Commit 40d4697

Browse files
Jonathan Sabbejhon287
Jonathan Sabbe
authored andcommitted
fix: Make WSREP SST user's privileges customizable
1 parent f1b0deb commit 40d4697

File tree

6 files changed

+46
-23
lines changed

6 files changed

+46
-23
lines changed

manifests/cluster.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@
6868
$wsrep_sst_password = $mariadb::params::wsrep_sst_password,
6969
$wsrep_sst_user_tls_options = undef,
7070
$wsrep_sst_user_grant_options = undef,
71-
Enum['mariabackup', 'mysqldump', 'rsync', 'rsync_wan', 'xtrabackup', 'xtrabackup-v2'] $wsrep_sst_method = $mariadb::params::wsrep_sst_method, # lint:ignore:140chars
71+
Array[String] $wresp_sst_user_privileges = $mariadb::params::wsrep_sst_user_privileges,
72+
Mariadb::Wsrep_SST_Method $wsrep_sst_method = $mariadb::params::wsrep_sst_method,
7273
$root_password = $mariadb::params::root_password,
7374
$override_options = {},
7475
$galera_override_options = {},
@@ -81,7 +82,6 @@
8182
$grants = {},
8283
$databases = {},
8384
) inherits mariadb::params {
84-
8585
$cluster_options = mysql::normalise_and_deepmerge($mariadb::params::cluster_default_options, $override_options)
8686
$galera_options = mysql::normalise_and_deepmerge($mariadb::params::galera_default_options, $galera_override_options)
8787

manifests/cluster/auth.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#
55

66
class mariadb::cluster::auth {
7-
87
if $mariadb::cluster::wsrep_sst_password != 'UNSET' {
98
$wsrep_sst_peers = any2array($mariadb::cluster::wsrep_sst_user_peers)
109
$wsrep_sst_users = prefix($wsrep_sst_peers, "${mariadb::cluster::wsrep_sst_user}@")
@@ -13,6 +12,7 @@
1312
wsrep_sst_password => $mariadb::cluster::wsrep_sst_password,
1413
wsrep_sst_user_tls_options => $mariadb::cluster::wsrep_sst_user_tls_options,
1514
wsrep_sst_user_grant_options => $mariadb::cluster::wsrep_sst_user_grant_options,
15+
wsrep_sst_user_privileges => $mariadb::cluster::wsrep_sst_user_privileges,
1616
}
1717
}
1818
}

manifests/cluster/wsrep_sst_user.pp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
# wsrep_sst_user.pp
2-
# Manage one wsrep_sst_auth user.
1+
# @summary Manage one wsrep_sst_auth user
2+
#
33
# This user is used to sync between cluster nodes and thus needs root like access to everything.
44
#
5-
5+
# @param wsrep_sst_password
6+
# @param wsrep_sst_user
7+
# @param wsrep_sst_user_tls_options
8+
# @param wsrep_sst_user_grant_options
9+
# @param wsrep_sst_user_privileges
10+
#
611
define mariadb::cluster::wsrep_sst_user (
7-
$wsrep_sst_password,
8-
$wsrep_sst_user = $name,
9-
$wsrep_sst_user_tls_options = undef,
10-
$wsrep_sst_user_grant_options = undef,
12+
String $wsrep_sst_password,
13+
String $wsrep_sst_user = $name,
14+
Array[String] $wsrep_sst_user_tls_options = undef,
15+
Array[String] $wsrep_sst_user_grant_options = undef,
16+
Array[String] $wsrep_sst_user_privileges = [
17+
'RELOAD',
18+
'PROCESS',
19+
'LOCK TABLES',
20+
'BINLOG MONITOR',
21+
],
1122
) {
12-
1323
mysql_user { $wsrep_sst_user:
1424
ensure => present,
1525
password_hash => mysql::password($wsrep_sst_password),
@@ -21,7 +31,7 @@
2131
ensure => present,
2232
user => $wsrep_sst_user,
2333
table => '*.*',
24-
privileges => ['ALL'],
34+
privileges => $wsrep_sst_user_privileges,
2535
options => $wsrep_sst_user_grant_options,
2636
}
2737
}

manifests/params.pp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# params.pp
22
# Set up MariaDB Cluster parameters defaults etc.
33
#
4-
54
class mariadb::params {
65
include 'mysql::params'
76

@@ -20,15 +19,21 @@
2019
}
2120

2221
# wsrep patch config
23-
$wsrep_cluster_address = undef
24-
$wsrep_cluster_peers = undef
25-
$wsrep_cluster_port = '4567'
26-
$wsrep_cluster_name = undef
27-
$wsrep_sst_user = 'wsrep_sst'
28-
$wsrep_sst_user_peers = '%'
29-
$wsrep_sst_password = 'UNSET' # lint:ignore:security_password_in_code
30-
$wsrep_sst_method = 'mysqldump'
31-
$root_password = 'UNSET' # lint:ignore:security_password_in_code
22+
$wsrep_cluster_address = undef
23+
$wsrep_cluster_peers = undef
24+
$wsrep_cluster_port = '4567'
25+
$wsrep_cluster_name = undef
26+
$wsrep_sst_user = 'wsrep_sst'
27+
$wsrep_sst_user_peers = '%'
28+
$wsrep_sst_password = 'UNSET' # lint:ignore:security_password_in_code
29+
$wsrep_sst_user_privileges = [
30+
'RELOAD',
31+
'PROCESS',
32+
'LOCK TABLES',
33+
'BINLOG MONITOR',
34+
]
35+
$wsrep_sst_method = 'mysqldump'
36+
$root_password = 'UNSET' # lint:ignore:security_password_in_code
3237

3338
if ($::osfamily == 'RedHat') and (versioncmp($::operatingsystemrelease, '6.0') >= 0) {
3439
# client.pp

manifests/types/wsrep_sst_method.pp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
type Mariadb::Wsrep_SST_Method = Enum[
2+
'mariabackup',
3+
'mysqldump',
4+
'rsync',
5+
'rsync_wan',
6+
'xtrabackup',
7+
'xtrabackup-v2'
8+
]

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "edestecd-mariadb",
3-
"version": "2.1.2",
3+
"version": "2.1.3",
44
"author": "Chris Edester",
55
"summary": "Puppet Module for managing MariaDB",
66
"license": "GPL-3.0+",

0 commit comments

Comments
 (0)