|
49 | 49 | password_hash => mysql::password($backuppassword),
|
50 | 50 | require => Class['mysql::server::root_password'],
|
51 | 51 | }
|
52 |
| - |
53 |
| - if ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '11') >= 0) or |
54 |
| - ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '22.04') >= 0) { |
55 |
| - mysql_grant { "${backupuser}@localhost/*.*": |
| 52 | + # Percona XtraBackup needs additional grants/privileges to work with MySQL 8 |
| 53 | + if versioncmp($facts['mysql_version'], '8') >= 0 and !(/(?i:mariadb)/ in $facts['mysqld_version']) { |
| 54 | + if ($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'], '11') >= 0) or |
| 55 | + ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '22.04') >= 0) { |
| 56 | + mysql_grant { "${backupuser}@localhost/*.*": |
| 57 | + ensure => $ensure, |
| 58 | + user => "${backupuser}@localhost", |
| 59 | + table => '*.*', |
| 60 | + privileges => ['BINLOG MONITOR', 'RELOAD', 'PROCESS', 'LOCK TABLES', 'BACKUP_ADMIN'], |
| 61 | + require => Mysql_user["${backupuser}@localhost"], |
| 62 | + } |
| 63 | + } |
| 64 | + else { |
| 65 | + mysql_grant { "${backupuser}@localhost/*.*": |
| 66 | + ensure => $ensure, |
| 67 | + user => "${backupuser}@localhost", |
| 68 | + table => '*.*', |
| 69 | + privileges => ['RELOAD', 'PROCESS', 'LOCK TABLES', 'REPLICATION CLIENT', 'BACKUP_ADMIN'], |
| 70 | + require => Mysql_user["${backupuser}@localhost"], |
| 71 | + } |
| 72 | + } |
| 73 | + mysql_grant { "${backupuser}@localhost/performance_schema.keyring_component_status": |
56 | 74 | ensure => $ensure,
|
57 | 75 | user => "${backupuser}@localhost",
|
58 |
| - table => '*.*', |
59 |
| - privileges => ['BINLOG MONITOR', 'RELOAD', 'PROCESS', 'LOCK TABLES'], |
| 76 | + table => 'performance_schema.keyring_component_status', |
| 77 | + privileges => ['SELECT'], |
60 | 78 | require => Mysql_user["${backupuser}@localhost"],
|
61 | 79 | }
|
62 |
| - } |
63 |
| - else { |
64 |
| - mysql_grant { "${backupuser}@localhost/*.*": |
| 80 | + mysql_grant { "${backupuser}@localhost/performance_schema.log_status": |
65 | 81 | ensure => $ensure,
|
66 | 82 | user => "${backupuser}@localhost",
|
67 |
| - table => '*.*', |
68 |
| - privileges => ['RELOAD', 'PROCESS', 'LOCK TABLES', 'REPLICATION CLIENT'], |
| 83 | + table => 'performance_schema.log_status', |
| 84 | + privileges => ['SELECT'], |
69 | 85 | require => Mysql_user["${backupuser}@localhost"],
|
70 | 86 | }
|
71 | 87 | }
|
| 88 | + else { |
| 89 | + if $facts['os']['family'] == 'debian' and $facts['os']['release']['major'] == '11' or |
| 90 | + ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '22.04') >= 0) { |
| 91 | + mysql_grant { "${backupuser}@localhost/*.*": |
| 92 | + ensure => $ensure, |
| 93 | + user => "${backupuser}@localhost", |
| 94 | + table => '*.*', |
| 95 | + privileges => ['BINLOG MONITOR', 'RELOAD', 'PROCESS', 'LOCK TABLES'], |
| 96 | + require => Mysql_user["${backupuser}@localhost"], |
| 97 | + } |
| 98 | + } |
| 99 | + else { |
| 100 | + mysql_grant { "${backupuser}@localhost/*.*": |
| 101 | + ensure => $ensure, |
| 102 | + user => "${backupuser}@localhost", |
| 103 | + table => '*.*', |
| 104 | + privileges => ['RELOAD', 'PROCESS', 'LOCK TABLES', 'REPLICATION CLIENT'], |
| 105 | + require => Mysql_user["${backupuser}@localhost"], |
| 106 | + } |
| 107 | + } |
| 108 | + } |
72 | 109 | }
|
73 | 110 |
|
74 | 111 | if $install_cron {
|
|
0 commit comments