Mercurial > repos > other > Puppet
comparison modules/mysql/REFERENCE.md @ 244:48d3a1948e4d
Update MySQL module
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 21 Dec 2019 14:11:43 -0500 |
parents | |
children | 668df4711671 |
comparison
equal
deleted
inserted
replaced
243:aad92dbc0efc | 244:48d3a1948e4d |
---|---|
1 # Reference | |
2 <!-- DO NOT EDIT: This document was generated by Puppet Strings --> | |
3 | |
4 ## Table of Contents | |
5 | |
6 **Classes** | |
7 | |
8 _Public Classes_ | |
9 | |
10 * [`mysql::bindings`](#mysqlbindings): Parent class for MySQL bindings. | |
11 * [`mysql::client`](#mysqlclient): Installs and configures the MySQL client. | |
12 * [`mysql::server`](#mysqlserver): Installs and configures the MySQL server. | |
13 * [`mysql::server::backup`](#mysqlserverbackup): Create and manage a MySQL backup. | |
14 * [`mysql::server::monitor`](#mysqlservermonitor): This is a helper class to add a monitoring user to the database | |
15 * [`mysql::server::mysqltuner`](#mysqlservermysqltuner): Manage the MySQLTuner package. | |
16 | |
17 _Private Classes_ | |
18 | |
19 * `mysql::backup::mysqlbackup`: Manage the mysqlbackup client. | |
20 * `mysql::backup::mysqldump`: "Provider" for mysqldump | |
21 * `mysql::backup::xtrabackup`: "Provider" for Percona XtraBackup/MariaBackup | |
22 * `mysql::bindings::client_dev`: Private class for installing client development bindings | |
23 * `mysql::bindings::daemon_dev`: Private class for installing daemon development bindings | |
24 * `mysql::bindings::java`: Private class for installing java language bindings. | |
25 * `mysql::bindings::perl`: Private class for installing perl language bindings. | |
26 * `mysql::bindings::php`: Private class for installing php language bindings | |
27 * `mysql::bindings::python`: Private class for installing python language bindings | |
28 * `mysql::bindings::ruby`: Private class for installing ruby language bindings | |
29 * `mysql::client::install`: Private class for MySQL client install. | |
30 * `mysql::params`: Params class. | |
31 * `mysql::server::account_security`: Private class for ensuring localhost accounts do not exist | |
32 * `mysql::server::binarylog`: Binary log configuration requires the mysql user to be present. This must be done after package install | |
33 * `mysql::server::config`: Private class for MySQL server configuration. | |
34 * `mysql::server::install`: Private class for managing MySQL package. | |
35 * `mysql::server::installdb`: Builds initial databases on installation. | |
36 * `mysql::server::providers`: Convenience class to call each of the three providers with the corresponding hashes provided in mysql::server. | |
37 * `mysql::server::root_password`: Private class for managing the root password | |
38 * `mysql::server::service`: Private class for managing the MySQL service | |
39 | |
40 **Defined types** | |
41 | |
42 * [`mysql::db`](#mysqldb): Create and configure a MySQL database. | |
43 | |
44 **Resource types** | |
45 | |
46 _Public Resource types_ | |
47 | |
48 * [`mysql_grant`](#mysql_grant): @summary Manage a MySQL user's rights. | |
49 * [`mysql_plugin`](#mysql_plugin): Manage MySQL plugins. | |
50 * [`mysql_user`](#mysql_user): @summary Manage a MySQL user. This includes management of users password as well as privileges. | |
51 | |
52 _Private Resource types_ | |
53 | |
54 * `mysql_database`: Manage a MySQL database. | |
55 * `mysql_datadir`: Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above). | |
56 | |
57 **Functions** | |
58 | |
59 * [`mysql::normalise_and_deepmerge`](#mysqlnormalise_and_deepmerge): Recursively merges two or more hashes together, normalises keys with differing use of dashesh and underscores, | |
60 then returns the resulting hash. | |
61 * [`mysql::password`](#mysqlpassword): Hash a string as mysql's "PASSWORD()" function would do it | |
62 * [`mysql::strip_hash`](#mysqlstrip_hash): When given a hash this function strips out all blank entries. | |
63 * [`mysql_password`](#mysql_password): Hash a string as mysql's "PASSWORD()" function would do it | |
64 | |
65 **Tasks** | |
66 | |
67 * [`export`](#export): Allows you to backup your database to local file. | |
68 * [`sql`](#sql): Allows you to execute arbitary SQL | |
69 | |
70 ## Classes | |
71 | |
72 ### mysql::bindings | |
73 | |
74 Parent class for MySQL bindings. | |
75 | |
76 #### Examples | |
77 | |
78 ##### Install Ruby language bindings | |
79 | |
80 ```puppet | |
81 class { 'mysql::bindings': | |
82 ruby_enable => true, | |
83 ruby_package_ensure => 'present', | |
84 ruby_package_name => 'ruby-mysql-2.7.1-1mdv2007.0.sparc.rpm', | |
85 ruby_package_provider => 'rpm', | |
86 } | |
87 ``` | |
88 | |
89 #### Parameters | |
90 | |
91 The following parameters are available in the `mysql::bindings` class. | |
92 | |
93 ##### `install_options` | |
94 | |
95 Data type: `Any` | |
96 | |
97 Passes `install_options` array to managed package resources. You must pass the [appropriate options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) for the package manager(s). | |
98 | |
99 Default value: `undef` | |
100 | |
101 ##### `java_enable` | |
102 | |
103 Data type: `Any` | |
104 | |
105 Specifies whether `::mysql::bindings::java` should be included. Valid values are `true`, `false`. | |
106 | |
107 Default value: `false` | |
108 | |
109 ##### `perl_enable` | |
110 | |
111 Data type: `Any` | |
112 | |
113 Specifies whether `mysql::bindings::perl` should be included. Valid values are `true`, `false`. | |
114 | |
115 Default value: `false` | |
116 | |
117 ##### `php_enable` | |
118 | |
119 Data type: `Any` | |
120 | |
121 Specifies whether `mysql::bindings::php` should be included. Valid values are `true`, `false`. | |
122 | |
123 Default value: `false` | |
124 | |
125 ##### `python_enable` | |
126 | |
127 Data type: `Any` | |
128 | |
129 Specifies whether `mysql::bindings::python` should be included. Valid values are `true`, `false`. | |
130 | |
131 Default value: `false` | |
132 | |
133 ##### `ruby_enable` | |
134 | |
135 Data type: `Any` | |
136 | |
137 Specifies whether `mysql::bindings::ruby` should be included. Valid values are `true`, `false`. | |
138 | |
139 Default value: `false` | |
140 | |
141 ##### `client_dev` | |
142 | |
143 Data type: `Any` | |
144 | |
145 Specifies whether `::mysql::bindings::client_dev` should be included. Valid values are `true`', `false`. | |
146 | |
147 Default value: `false` | |
148 | |
149 ##### `daemon_dev` | |
150 | |
151 Data type: `Any` | |
152 | |
153 Specifies whether `::mysql::bindings::daemon_dev` should be included. Valid values are `true`, `false`. | |
154 | |
155 Default value: `false` | |
156 | |
157 ##### `java_package_ensure` | |
158 | |
159 Data type: `Any` | |
160 | |
161 Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `java_enable => true`. | |
162 | |
163 Default value: $mysql::params::java_package_ensure | |
164 | |
165 ##### `java_package_name` | |
166 | |
167 Data type: `Any` | |
168 | |
169 The name of the Java package to install. Only applies if `java_enable => true`. | |
170 | |
171 Default value: $mysql::params::java_package_name | |
172 | |
173 ##### `java_package_provider` | |
174 | |
175 Data type: `Any` | |
176 | |
177 The provider to use to install the Java package. Only applies if `java_enable => true`. | |
178 | |
179 Default value: $mysql::params::java_package_provider | |
180 | |
181 ##### `perl_package_ensure` | |
182 | |
183 Data type: `Any` | |
184 | |
185 Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `perl_enable => true`. | |
186 | |
187 Default value: $mysql::params::perl_package_ensure | |
188 | |
189 ##### `perl_package_name` | |
190 | |
191 Data type: `Any` | |
192 | |
193 The name of the Perl package to install. Only applies if `perl_enable => true`. | |
194 | |
195 Default value: $mysql::params::perl_package_name | |
196 | |
197 ##### `perl_package_provider` | |
198 | |
199 Data type: `Any` | |
200 | |
201 The provider to use to install the Perl package. Only applies if `perl_enable => true`. | |
202 | |
203 Default value: $mysql::params::perl_package_provider | |
204 | |
205 ##### `php_package_ensure` | |
206 | |
207 Data type: `Any` | |
208 | |
209 Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `php_enable => true`. | |
210 | |
211 Default value: $mysql::params::php_package_ensure | |
212 | |
213 ##### `php_package_name` | |
214 | |
215 Data type: `Any` | |
216 | |
217 The name of the PHP package to install. Only applies if `php_enable => true`. | |
218 | |
219 Default value: $mysql::params::php_package_name | |
220 | |
221 ##### `php_package_provider` | |
222 | |
223 Data type: `Any` | |
224 | |
225 The provider to use to install the PHP package. Only applies if `php_enable => true`. | |
226 | |
227 Default value: $mysql::params::php_package_provider | |
228 | |
229 ##### `python_package_ensure` | |
230 | |
231 Data type: `Any` | |
232 | |
233 Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `python_enable => true`. | |
234 | |
235 Default value: $mysql::params::python_package_ensure | |
236 | |
237 ##### `python_package_name` | |
238 | |
239 Data type: `Any` | |
240 | |
241 The name of the Python package to install. Only applies if `python_enable => true`. | |
242 | |
243 Default value: $mysql::params::python_package_name | |
244 | |
245 ##### `python_package_provider` | |
246 | |
247 Data type: `Any` | |
248 | |
249 The provider to use to install the Python package. Only applies if `python_enable => true`. | |
250 | |
251 Default value: $mysql::params::python_package_provider | |
252 | |
253 ##### `ruby_package_ensure` | |
254 | |
255 Data type: `Any` | |
256 | |
257 Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `ruby_enable => true`. | |
258 | |
259 Default value: $mysql::params::ruby_package_ensure | |
260 | |
261 ##### `ruby_package_name` | |
262 | |
263 Data type: `Any` | |
264 | |
265 The name of the Ruby package to install. Only applies if `ruby_enable => true`. | |
266 | |
267 Default value: $mysql::params::ruby_package_name | |
268 | |
269 ##### `ruby_package_provider` | |
270 | |
271 Data type: `Any` | |
272 | |
273 What provider should be used to install the package. | |
274 | |
275 Default value: $mysql::params::ruby_package_provider | |
276 | |
277 ##### `client_dev_package_ensure` | |
278 | |
279 Data type: `Any` | |
280 | |
281 Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `client_dev => true`. | |
282 | |
283 Default value: $mysql::params::client_dev_package_ensure | |
284 | |
285 ##### `client_dev_package_name` | |
286 | |
287 Data type: `Any` | |
288 | |
289 The name of the client_dev package to install. Only applies if `client_dev => true`. | |
290 | |
291 Default value: $mysql::params::client_dev_package_name | |
292 | |
293 ##### `client_dev_package_provider` | |
294 | |
295 Data type: `Any` | |
296 | |
297 The provider to use to install the client_dev package. Only applies if `client_dev => true`. | |
298 | |
299 Default value: $mysql::params::client_dev_package_provider | |
300 | |
301 ##### `daemon_dev_package_ensure` | |
302 | |
303 Data type: `Any` | |
304 | |
305 Whether the package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Only applies if `daemon_dev => true`. | |
306 | |
307 Default value: $mysql::params::daemon_dev_package_ensure | |
308 | |
309 ##### `daemon_dev_package_name` | |
310 | |
311 Data type: `Any` | |
312 | |
313 The name of the daemon_dev package to install. Only applies if `daemon_dev => true`. | |
314 | |
315 Default value: $mysql::params::daemon_dev_package_name | |
316 | |
317 ##### `daemon_dev_package_provider` | |
318 | |
319 Data type: `Any` | |
320 | |
321 The provider to use to install the daemon_dev package. Only applies if `daemon_dev => true`. | |
322 | |
323 Default value: $mysql::params::daemon_dev_package_provider | |
324 | |
325 ### mysql::client | |
326 | |
327 Installs and configures the MySQL client. | |
328 | |
329 #### Examples | |
330 | |
331 ##### Install the MySQL client | |
332 | |
333 ```puppet | |
334 class {'::mysql::client': | |
335 package_name => 'mysql-client', | |
336 package_ensure => 'present', | |
337 bindings_enable => true, | |
338 } | |
339 ``` | |
340 | |
341 #### Parameters | |
342 | |
343 The following parameters are available in the `mysql::client` class. | |
344 | |
345 ##### `bindings_enable` | |
346 | |
347 Data type: `Any` | |
348 | |
349 Whether to automatically install all bindings. Valid values are `true`, `false`. Default to `false`. | |
350 | |
351 Default value: $mysql::params::bindings_enable | |
352 | |
353 ##### `install_options` | |
354 | |
355 Data type: `Any` | |
356 | |
357 Array of install options for managed package resources. You must pass the appropriate options for the package manager. | |
358 | |
359 Default value: `undef` | |
360 | |
361 ##### `package_ensure` | |
362 | |
363 Data type: `Any` | |
364 | |
365 Whether the MySQL package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. | |
366 | |
367 Default value: $mysql::params::client_package_ensure | |
368 | |
369 ##### `package_manage` | |
370 | |
371 Data type: `Any` | |
372 | |
373 Whether to manage the MySQL client package. Defaults to `true`. | |
374 | |
375 Default value: $mysql::params::client_package_manage | |
376 | |
377 ##### `package_name` | |
378 | |
379 Data type: `Any` | |
380 | |
381 The name of the MySQL client package to install. | |
382 | |
383 Default value: $mysql::params::client_package_name | |
384 | |
385 ### mysql::server | |
386 | |
387 Installs and configures the MySQL server. | |
388 | |
389 #### Examples | |
390 | |
391 ##### Install MySQL Server | |
392 | |
393 ```puppet | |
394 class { '::mysql::server': | |
395 package_name => 'mysql-server', | |
396 package_ensure => '5.7.1+mysql~trusty', | |
397 root_password => 'strongpassword', | |
398 remove_default_accounts => true, | |
399 } | |
400 ``` | |
401 | |
402 #### Parameters | |
403 | |
404 The following parameters are available in the `mysql::server` class. | |
405 | |
406 ##### `config_file` | |
407 | |
408 Data type: `Any` | |
409 | |
410 The location, as a path, of the MySQL configuration file. | |
411 | |
412 Default value: $mysql::params::config_file | |
413 | |
414 ##### `includedir` | |
415 | |
416 Data type: `Any` | |
417 | |
418 The location, as a path, of !includedir for custom configuration overrides. | |
419 | |
420 Default value: $mysql::params::includedir | |
421 | |
422 ##### `install_options` | |
423 | |
424 Data type: `Any` | |
425 | |
426 Passes [install_options](https://docs.puppetlabs.com/references/latest/type.html#package-attribute-install_options) array to managed package resources. You must pass the appropriate options for the specified package manager | |
427 | |
428 Default value: `undef` | |
429 | |
430 ##### `install_secret_file` | |
431 | |
432 Data type: `Any` | |
433 | |
434 Path to secret file containing temporary root password. | |
435 | |
436 Default value: $mysql::params::install_secret_file | |
437 | |
438 ##### `manage_config_file` | |
439 | |
440 Data type: `Any` | |
441 | |
442 Whether the MySQL configuration file should be managed. Valid values are `true`, `false`. Defaults to `true`. | |
443 | |
444 Default value: $mysql::params::manage_config_file | |
445 | |
446 ##### `override_options` | |
447 | |
448 Data type: `Any` | |
449 | |
450 Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: See above for usage details. | |
451 | |
452 Default value: {} | |
453 | |
454 ##### `package_ensure` | |
455 | |
456 Data type: `Any` | |
457 | |
458 Whether the package exists or should be a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Defaults to 'present'. | |
459 | |
460 Default value: $mysql::params::server_package_ensure | |
461 | |
462 ##### `package_manage` | |
463 | |
464 Data type: `Any` | |
465 | |
466 Whether to manage the MySQL server package. Defaults to `true`. | |
467 | |
468 Default value: $mysql::params::server_package_manage | |
469 | |
470 ##### `package_name` | |
471 | |
472 Data type: `Any` | |
473 | |
474 The name of the MySQL server package to install. | |
475 | |
476 Default value: $mysql::params::server_package_name | |
477 | |
478 ##### `purge_conf_dir` | |
479 | |
480 Data type: `Any` | |
481 | |
482 Whether the `includedir` directory should be purged. Valid values are `true`, `false`. Defaults to `false`. | |
483 | |
484 Default value: $mysql::params::purge_conf_dir | |
485 | |
486 ##### `remove_default_accounts` | |
487 | |
488 Data type: `Any` | |
489 | |
490 Specifies whether to automatically include `mysql::server::account_security`. Valid values are `true`, `false`. Defaults to `false`. | |
491 | |
492 Default value: `false` | |
493 | |
494 ##### `restart` | |
495 | |
496 Data type: `Any` | |
497 | |
498 Whether the service should be restarted when things change. Valid values are `true`, `false`. Defaults to `false`. | |
499 | |
500 Default value: $mysql::params::restart | |
501 | |
502 ##### `root_group` | |
503 | |
504 Data type: `Any` | |
505 | |
506 The name of the group used for root. Can be a group name or a group ID. See more about the [group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). | |
507 | |
508 Default value: $mysql::params::root_group | |
509 | |
510 ##### `mysql_group` | |
511 | |
512 Data type: `Any` | |
513 | |
514 The name of the group of the MySQL daemon user. Can be a group name or a group ID. See more about the [group](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). | |
515 | |
516 Default value: $mysql::params::mysql_group | |
517 | |
518 ##### `root_password` | |
519 | |
520 Data type: `Any` | |
521 | |
522 The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it. This is required if `create_root_user` or `create_root_my_cnf` are true. If `root_password` is 'UNSET', then `create_root_user` and `create_root_my_cnf` are assumed to be false --- that is, the MySQL root user and `/root/.my.cnf` are not created. Password changes are supported; however, the old password must be set in `/root/.my.cnf`. Effectively, Puppet uses the old password, configured in `/root/my.cnf`, to set the new password in MySQL, and then updates `/root/.my.cnf` with the new password. | |
523 | |
524 Default value: $mysql::params::root_password | |
525 | |
526 ##### `service_enabled` | |
527 | |
528 Data type: `Any` | |
529 | |
530 Specifies whether the service should be enabled. Valid values are `true`, `false`. Defaults to `true`. | |
531 | |
532 Default value: $mysql::params::server_service_enabled | |
533 | |
534 ##### `service_manage` | |
535 | |
536 Data type: `Any` | |
537 | |
538 Specifies whether the service should be managed. Valid values are `true`, `false`. Defaults to `true`. | |
539 | |
540 Default value: $mysql::params::server_service_manage | |
541 | |
542 ##### `service_name` | |
543 | |
544 Data type: `Any` | |
545 | |
546 The name of the MySQL server service. Defaults are OS dependent, defined in 'params.pp'. | |
547 | |
548 Default value: $mysql::params::server_service_name | |
549 | |
550 ##### `service_provider` | |
551 | |
552 Data type: `Any` | |
553 | |
554 The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined. | |
555 | |
556 Default value: $mysql::params::server_service_provider | |
557 | |
558 ##### `create_root_user` | |
559 | |
560 Data type: `Any` | |
561 | |
562 Whether root user should be created. Valid values are `true`, `false`. Defaults to `true`. This is useful for a cluster setup with Galera. The root user has to be created only once. You can set this parameter true on one node and set it to false on the remaining nodes. | |
563 | |
564 Default value: $mysql::params::create_root_user | |
565 | |
566 ##### `create_root_my_cnf` | |
567 | |
568 Data type: `Any` | |
569 | |
570 Whether to create `/root/.my.cnf`. Valid values are `true`, `false`. Defaults to `true`. `create_root_my_cnf` allows creation of `/root/.my.cnf` independently of `create_root_user`. You can use this for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes. | |
571 | |
572 Default value: $mysql::params::create_root_my_cnf | |
573 | |
574 ##### `users` | |
575 | |
576 Data type: `Any` | |
577 | |
578 Optional hash of users to create, which are passed to [mysql_user](#mysql_user). | |
579 | |
580 Default value: {} | |
581 | |
582 ##### `grants` | |
583 | |
584 Data type: `Any` | |
585 | |
586 Optional hash of grants, which are passed to [mysql_grant](#mysql_grant). | |
587 | |
588 Default value: {} | |
589 | |
590 ##### `databases` | |
591 | |
592 Data type: `Any` | |
593 | |
594 Optional hash of databases to create, which are passed to [mysql_database](#mysql_database). | |
595 | |
596 Default value: {} | |
597 | |
598 ##### `enabled` | |
599 | |
600 Data type: `Any` | |
601 | |
602 _Deprecated_ | |
603 | |
604 Default value: `undef` | |
605 | |
606 ##### `manage_service` | |
607 | |
608 Data type: `Any` | |
609 | |
610 _Deprecated_ | |
611 | |
612 Default value: `undef` | |
613 | |
614 ##### `old_root_password` | |
615 | |
616 Data type: `Any` | |
617 | |
618 This parameter no longer does anything. It exists only for backwards compatibility. See the `root_password` parameter above for details on changing the root password. | |
619 | |
620 Default value: `undef` | |
621 | |
622 ##### `create_root_login_file` | |
623 | |
624 Data type: `Any` | |
625 | |
626 | |
627 | |
628 Default value: $mysql::params::create_root_login_file | |
629 | |
630 ##### `login_file` | |
631 | |
632 Data type: `Any` | |
633 | |
634 | |
635 | |
636 Default value: $mysql::params::login_file | |
637 | |
638 ### mysql::server::backup | |
639 | |
640 Create and manage a MySQL backup. | |
641 | |
642 #### Examples | |
643 | |
644 ##### Create a basic MySQL backup: | |
645 | |
646 ```puppet | |
647 class { 'mysql::server': | |
648 root_password => 'password' | |
649 } | |
650 class { 'mysql::server::backup': | |
651 backupuser => 'myuser', | |
652 backuppassword => 'mypassword', | |
653 backupdir => '/tmp/backups', | |
654 } | |
655 class { 'mysql::server::backup': | |
656 backupmethod => 'mariabackup', | |
657 provider => 'xtrabackup', | |
658 backupdir => '/tmp/backups', | |
659 } | |
660 ``` | |
661 | |
662 #### Parameters | |
663 | |
664 The following parameters are available in the `mysql::server::backup` class. | |
665 | |
666 ##### `backupuser` | |
667 | |
668 Data type: `Any` | |
669 | |
670 MySQL user with backup administrator privileges. | |
671 | |
672 Default value: `undef` | |
673 | |
674 ##### `backuppassword` | |
675 | |
676 Data type: `Any` | |
677 | |
678 Password for `backupuser`. | |
679 | |
680 Default value: `undef` | |
681 | |
682 ##### `backupdir` | |
683 | |
684 Data type: `Any` | |
685 | |
686 Directory to store backup. | |
687 | |
688 Default value: `undef` | |
689 | |
690 ##### `backupdirmode` | |
691 | |
692 Data type: `Any` | |
693 | |
694 Permissions applied to the backup directory. This parameter is passed directly to the file resource. | |
695 | |
696 Default value: '0700' | |
697 | |
698 ##### `backupdirowner` | |
699 | |
700 Data type: `Any` | |
701 | |
702 Owner for the backup directory. This parameter is passed directly to the file resource. | |
703 | |
704 Default value: 'root' | |
705 | |
706 ##### `backupdirgroup` | |
707 | |
708 Data type: `Any` | |
709 | |
710 Group owner for the backup directory. This parameter is passed directly to the file resource. | |
711 | |
712 Default value: $mysql::params::root_group | |
713 | |
714 ##### `backupcompress` | |
715 | |
716 Data type: `Any` | |
717 | |
718 Whether or not to compress the backup (when using the mysqldump provider) | |
719 | |
720 Default value: `true` | |
721 | |
722 ##### `backupmethod` | |
723 | |
724 Data type: `Any` | |
725 | |
726 The execution binary for backing up. ex. mysqldump, xtrabackup, mariabackup | |
727 | |
728 Default value: `undef` | |
729 | |
730 ##### `backup_success_file_path` | |
731 | |
732 Data type: `Any` | |
733 | |
734 Specify a path where upon successfull backup a file should be created for checking purposes. | |
735 | |
736 Default value: '/tmp/mysqlbackup_success' | |
737 | |
738 ##### `backuprotate` | |
739 | |
740 Data type: `Any` | |
741 | |
742 Backup rotation interval in 24 hour periods. | |
743 | |
744 Default value: 30 | |
745 | |
746 ##### `ignore_events` | |
747 | |
748 Data type: `Any` | |
749 | |
750 Ignore the mysql.event table. | |
751 | |
752 Default value: `true` | |
753 | |
754 ##### `delete_before_dump` | |
755 | |
756 Data type: `Any` | |
757 | |
758 Whether to delete old .sql files before backing up. Setting to true deletes old files before backing up, while setting to false deletes them after backup. | |
759 | |
760 Default value: `false` | |
761 | |
762 ##### `backupdatabases` | |
763 | |
764 Data type: `Any` | |
765 | |
766 Databases to backup (required if using xtrabackup provider). By default `[]` will back up all databases. | |
767 | |
768 Default value: [] | |
769 | |
770 ##### `file_per_database` | |
771 | |
772 Data type: `Any` | |
773 | |
774 Use file per database mode creating one file per database backup. | |
775 | |
776 Default value: `false` | |
777 | |
778 ##### `include_routines` | |
779 | |
780 Data type: `Any` | |
781 | |
782 Dump stored routines (procedures and functions) from dumped databases when doing a `file_per_database` backup. | |
783 | |
784 Default value: `false` | |
785 | |
786 ##### `include_triggers` | |
787 | |
788 Data type: `Any` | |
789 | |
790 Dump triggers for each dumped table when doing a `file_per_database` backup. | |
791 | |
792 Default value: `false` | |
793 | |
794 ##### `ensure` | |
795 | |
796 Data type: `Any` | |
797 | |
798 | |
799 | |
800 Default value: 'present' | |
801 | |
802 ##### `time` | |
803 | |
804 Data type: `Any` | |
805 | |
806 An array of two elements to set the backup time. Allows ['23', '5'] (i.e., 23:05) or ['3', '45'] (i.e., 03:45) for HH:MM times. | |
807 | |
808 Default value: ['23', '5'] | |
809 | |
810 ##### `prescript` | |
811 | |
812 Data type: `Any` | |
813 | |
814 A script that is executed before the backup begins. | |
815 | |
816 Default value: `false` | |
817 | |
818 ##### `postscript` | |
819 | |
820 Data type: `Any` | |
821 | |
822 A script that is executed when the backup is finished. This could be used to sync the backup to a central store. This script can be either a single line that is directly executed or a number of lines supplied as an array. It could also be one or more externally managed (executable) files. | |
823 | |
824 Default value: `false` | |
825 | |
826 ##### `execpath` | |
827 | |
828 Data type: `Any` | |
829 | |
830 Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. | |
831 | |
832 Default value: '/usr/bin:/usr/sbin:/bin:/sbin' | |
833 | |
834 ##### `provider` | |
835 | |
836 Data type: `Any` | |
837 | |
838 Sets the server backup implementation. Valid values are: | |
839 | |
840 Default value: 'mysqldump' | |
841 | |
842 ##### `maxallowedpacket` | |
843 | |
844 Data type: `Any` | |
845 | |
846 Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. | |
847 | |
848 Default value: '1M' | |
849 | |
850 ##### `optional_args` | |
851 | |
852 Data type: `Any` | |
853 | |
854 Specifies an array of optional arguments which should be passed through to the backup tool. (Supported by the xtrabackup and mysqldump providers.) | |
855 | |
856 Default value: [] | |
857 | |
858 ### mysql::server::monitor | |
859 | |
860 This is a helper class to add a monitoring user to the database | |
861 | |
862 #### Parameters | |
863 | |
864 The following parameters are available in the `mysql::server::monitor` class. | |
865 | |
866 ##### `mysql_monitor_username` | |
867 | |
868 Data type: `Any` | |
869 | |
870 The username to create for MySQL monitoring. | |
871 | |
872 Default value: '' | |
873 | |
874 ##### `mysql_monitor_password` | |
875 | |
876 Data type: `Any` | |
877 | |
878 The password to create for MySQL monitoring. | |
879 | |
880 Default value: '' | |
881 | |
882 ##### `mysql_monitor_hostname` | |
883 | |
884 Data type: `Any` | |
885 | |
886 The hostname from which the monitoring user requests are allowed access. | |
887 | |
888 Default value: '' | |
889 | |
890 ### mysql::server::mysqltuner | |
891 | |
892 Manage the MySQLTuner package. | |
893 | |
894 #### Parameters | |
895 | |
896 The following parameters are available in the `mysql::server::mysqltuner` class. | |
897 | |
898 ##### `ensure` | |
899 | |
900 Data type: `Any` | |
901 | |
902 Ensures that the resource exists. Valid values are 'present', 'absent'. Defaults to 'present'. | |
903 | |
904 Default value: 'present' | |
905 | |
906 ##### `version` | |
907 | |
908 Data type: `Any` | |
909 | |
910 The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. Defaults to 'v1.3.0'. | |
911 | |
912 Default value: 'v1.3.0' | |
913 | |
914 ##### `source` | |
915 | |
916 Data type: `Any` | |
917 | |
918 Source path for the mysqltuner package. | |
919 | |
920 Default value: `undef` | |
921 | |
922 ##### `tuner_location` | |
923 | |
924 Data type: `Any` | |
925 | |
926 Destination for the mysqltuner package. | |
927 | |
928 Default value: '/usr/local/bin/mysqltuner' | |
929 | |
930 ## Defined types | |
931 | |
932 ### mysql::db | |
933 | |
934 Create and configure a MySQL database. | |
935 | |
936 #### Examples | |
937 | |
938 ##### Create a database | |
939 | |
940 ```puppet | |
941 mysql::db { 'mydb': | |
942 user => 'myuser', | |
943 password => 'mypass', | |
944 host => 'localhost', | |
945 grant => ['SELECT', 'UPDATE'], | |
946 } | |
947 ``` | |
948 | |
949 #### Parameters | |
950 | |
951 The following parameters are available in the `mysql::db` defined type. | |
952 | |
953 ##### `user` | |
954 | |
955 Data type: `Any` | |
956 | |
957 The user for the database you're creating. | |
958 | |
959 ##### `password` | |
960 | |
961 Data type: `Any` | |
962 | |
963 The password for $user for the database you're creating. | |
964 | |
965 ##### `tls_options` | |
966 | |
967 Data type: `Any` | |
968 | |
969 The tls_options for $user for the database you're creating. | |
970 | |
971 Default value: `undef` | |
972 | |
973 ##### `dbname` | |
974 | |
975 Data type: `Any` | |
976 | |
977 The name of the database to create. | |
978 | |
979 Default value: $name | |
980 | |
981 ##### `charset` | |
982 | |
983 Data type: `Any` | |
984 | |
985 The character set for the database. | |
986 | |
987 Default value: 'utf8' | |
988 | |
989 ##### `collate` | |
990 | |
991 Data type: `Any` | |
992 | |
993 The collation for the database. | |
994 | |
995 Default value: 'utf8_general_ci' | |
996 | |
997 ##### `host` | |
998 | |
999 Data type: `Any` | |
1000 | |
1001 The host to use as part of user@host for grants. | |
1002 | |
1003 Default value: 'localhost' | |
1004 | |
1005 ##### `grant` | |
1006 | |
1007 Data type: `Any` | |
1008 | |
1009 The privileges to be granted for user@host on the database. | |
1010 | |
1011 Default value: 'ALL' | |
1012 | |
1013 ##### `grant_options` | |
1014 | |
1015 Data type: `Any` | |
1016 | |
1017 The grant_options for the grant for user@host on the database. | |
1018 | |
1019 Default value: `undef` | |
1020 | |
1021 ##### `sql` | |
1022 | |
1023 Data type: `Optional[Variant[Array, Hash, String]]` | |
1024 | |
1025 The path to the sqlfile you want to execute. This can be single file specified as string, or it can be an array of strings. | |
1026 | |
1027 Default value: `undef` | |
1028 | |
1029 ##### `enforce_sql` | |
1030 | |
1031 Data type: `Any` | |
1032 | |
1033 Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once. | |
1034 | |
1035 Default value: `false` | |
1036 | |
1037 ##### `ensure` | |
1038 | |
1039 Data type: `Enum['absent', 'present']` | |
1040 | |
1041 Specifies whether to create the database. Valid values are 'present', 'absent'. Defaults to 'present'. | |
1042 | |
1043 Default value: 'present' | |
1044 | |
1045 ##### `import_timeout` | |
1046 | |
1047 Data type: `Any` | |
1048 | |
1049 Timeout, in seconds, for loading the sqlfiles. Defaults to 300. | |
1050 | |
1051 Default value: 300 | |
1052 | |
1053 ##### `import_cat_cmd` | |
1054 | |
1055 Data type: `Any` | |
1056 | |
1057 Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files. | |
1058 | |
1059 Default value: 'cat' | |
1060 | |
1061 ##### `mysql_exec_path` | |
1062 | |
1063 Data type: `Any` | |
1064 | |
1065 | |
1066 | |
1067 Default value: $mysql::params::exec_path | |
1068 | |
1069 ## Resource types | |
1070 | |
1071 ### mysql_grant | |
1072 | |
1073 @summary | |
1074 Manage a MySQL user's rights. | |
1075 | |
1076 #### Properties | |
1077 | |
1078 The following properties are available in the `mysql_grant` type. | |
1079 | |
1080 ##### `ensure` | |
1081 | |
1082 Valid values: present, absent | |
1083 | |
1084 The basic property that the resource should be in. | |
1085 | |
1086 Default value: present | |
1087 | |
1088 ##### `privileges` | |
1089 | |
1090 Privileges for user | |
1091 | |
1092 ##### `table` | |
1093 | |
1094 Valid values: %r{.*\..*}, %r{^[0-9a-zA-Z$_]*@[\w%\.:\-/]*$} | |
1095 | |
1096 Table to apply privileges to. | |
1097 | |
1098 ##### `user` | |
1099 | |
1100 User to operate on. | |
1101 | |
1102 ##### `options` | |
1103 | |
1104 Options to grant. | |
1105 | |
1106 #### Parameters | |
1107 | |
1108 The following parameters are available in the `mysql_grant` type. | |
1109 | |
1110 ##### `name` | |
1111 | |
1112 namevar | |
1113 | |
1114 Name to describe the grant. | |
1115 | |
1116 ### mysql_plugin | |
1117 | |
1118 Manage MySQL plugins. | |
1119 | |
1120 #### Examples | |
1121 | |
1122 ##### | |
1123 | |
1124 ```puppet | |
1125 mysql_plugin { 'some_plugin': | |
1126 soname => 'some_pluginlib.so', | |
1127 } | |
1128 ``` | |
1129 | |
1130 #### Properties | |
1131 | |
1132 The following properties are available in the `mysql_plugin` type. | |
1133 | |
1134 ##### `ensure` | |
1135 | |
1136 Valid values: present, absent | |
1137 | |
1138 The basic property that the resource should be in. | |
1139 | |
1140 Default value: present | |
1141 | |
1142 ##### `soname` | |
1143 | |
1144 Valid values: %r{^\w+\.\w+$} | |
1145 | |
1146 The name of the library | |
1147 | |
1148 #### Parameters | |
1149 | |
1150 The following parameters are available in the `mysql_plugin` type. | |
1151 | |
1152 ##### `name` | |
1153 | |
1154 namevar | |
1155 | |
1156 The name of the MySQL plugin to manage. | |
1157 | |
1158 ### mysql_user | |
1159 | |
1160 @summary | |
1161 Manage a MySQL user. This includes management of users password as well as privileges. | |
1162 | |
1163 #### Properties | |
1164 | |
1165 The following properties are available in the `mysql_user` type. | |
1166 | |
1167 ##### `ensure` | |
1168 | |
1169 Valid values: present, absent | |
1170 | |
1171 The basic property that the resource should be in. | |
1172 | |
1173 Default value: present | |
1174 | |
1175 ##### `password_hash` | |
1176 | |
1177 Valid values: %r{\w*} | |
1178 | |
1179 The password hash of the user. Use mysql_password() for creating such a hash. | |
1180 | |
1181 ##### `plugin` | |
1182 | |
1183 Valid values: %r{\w+} | |
1184 | |
1185 The authentication plugin of the user. | |
1186 | |
1187 ##### `max_user_connections` | |
1188 | |
1189 Valid values: %r{\d+} | |
1190 | |
1191 Max concurrent connections for the user. 0 means no (or global) limit. | |
1192 | |
1193 ##### `max_connections_per_hour` | |
1194 | |
1195 Valid values: %r{\d+} | |
1196 | |
1197 Max connections per hour for the user. 0 means no (or global) limit. | |
1198 | |
1199 ##### `max_queries_per_hour` | |
1200 | |
1201 Valid values: %r{\d+} | |
1202 | |
1203 Max queries per hour for the user. 0 means no (or global) limit. | |
1204 | |
1205 ##### `max_updates_per_hour` | |
1206 | |
1207 Valid values: %r{\d+} | |
1208 | |
1209 Max updates per hour for the user. 0 means no (or global) limit. | |
1210 | |
1211 ##### `tls_options` | |
1212 | |
1213 Options to that set the TLS-related REQUIRE attributes for the user. | |
1214 | |
1215 #### Parameters | |
1216 | |
1217 The following parameters are available in the `mysql_user` type. | |
1218 | |
1219 ##### `name` | |
1220 | |
1221 namevar | |
1222 | |
1223 The name of the user. This uses the 'username@hostname' or username@hostname. | |
1224 | |
1225 ## Functions | |
1226 | |
1227 ### mysql::normalise_and_deepmerge | |
1228 | |
1229 Type: Ruby 4.x API | |
1230 | |
1231 - When there is a duplicate key that is a hash, they are recursively merged. | |
1232 - When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." | |
1233 - When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), the rightmost style will win. | |
1234 | |
1235 #### Examples | |
1236 | |
1237 ##### | |
1238 | |
1239 ```puppet | |
1240 $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } | |
1241 $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } | |
1242 $merged_hash = mysql::normalise_and_deepmerge($hash1, $hash2) | |
1243 # The resulting hash is equivalent to: | |
1244 # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } | |
1245 ``` | |
1246 | |
1247 #### `mysql::normalise_and_deepmerge(Any *$args)` | |
1248 | |
1249 - When there is a duplicate key that is a hash, they are recursively merged. | |
1250 - When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." | |
1251 - When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), the rightmost style will win. | |
1252 | |
1253 Returns: `Any` | |
1254 | |
1255 ##### Examples | |
1256 | |
1257 ###### | |
1258 | |
1259 ```puppet | |
1260 $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } | |
1261 $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } | |
1262 $merged_hash = mysql::normalise_and_deepmerge($hash1, $hash2) | |
1263 # The resulting hash is equivalent to: | |
1264 # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } | |
1265 ``` | |
1266 | |
1267 ##### `*args` | |
1268 | |
1269 Data type: `Any` | |
1270 | |
1271 | |
1272 | |
1273 ### mysql::password | |
1274 | |
1275 Type: Ruby 4.x API | |
1276 | |
1277 Hash a string as mysql's "PASSWORD()" function would do it | |
1278 | |
1279 #### `mysql::password(String $password)` | |
1280 | |
1281 The mysql::password function. | |
1282 | |
1283 Returns: `String` hash | |
1284 The mysql password hash from the clear text password. | |
1285 | |
1286 ##### `password` | |
1287 | |
1288 Data type: `String` | |
1289 | |
1290 Plain text password. | |
1291 | |
1292 ### mysql::strip_hash | |
1293 | |
1294 Type: Ruby 4.x API | |
1295 | |
1296 When given a hash this function strips out all blank entries. | |
1297 | |
1298 #### `mysql::strip_hash(Hash $hash)` | |
1299 | |
1300 The mysql::strip_hash function. | |
1301 | |
1302 Returns: `Hash` hash | |
1303 The given hash with all blank entries removed | |
1304 | |
1305 ##### `hash` | |
1306 | |
1307 Data type: `Hash` | |
1308 | |
1309 Hash to be stripped | |
1310 | |
1311 ### mysql_password | |
1312 | |
1313 Type: Ruby 3.x API | |
1314 | |
1315 Hash a string as mysql's "PASSWORD()" function would do it | |
1316 | |
1317 #### `mysql_password(String $password)` | |
1318 | |
1319 The mysql_password function. | |
1320 | |
1321 Returns: `String` the mysql password hash from the clear text password. | |
1322 | |
1323 ##### `password` | |
1324 | |
1325 Data type: `String` | |
1326 | |
1327 Plain text password. | |
1328 | |
1329 ## Tasks | |
1330 | |
1331 ### export | |
1332 | |
1333 Allows you to backup your database to local file. | |
1334 | |
1335 **Supports noop?** false | |
1336 | |
1337 #### Parameters | |
1338 | |
1339 ##### `database` | |
1340 | |
1341 Data type: `Optional[String[1]]` | |
1342 | |
1343 Database to connect to | |
1344 | |
1345 ##### `user` | |
1346 | |
1347 Data type: `Optional[String[1]]` | |
1348 | |
1349 The user | |
1350 | |
1351 ##### `password` | |
1352 | |
1353 Data type: `Optional[String[1]]` | |
1354 | |
1355 The password | |
1356 | |
1357 ##### `file` | |
1358 | |
1359 Data type: `String[1]` | |
1360 | |
1361 Path to file you want backup to | |
1362 | |
1363 ### sql | |
1364 | |
1365 Allows you to execute arbitary SQL | |
1366 | |
1367 **Supports noop?** false | |
1368 | |
1369 #### Parameters | |
1370 | |
1371 ##### `database` | |
1372 | |
1373 Data type: `Optional[String[1]]` | |
1374 | |
1375 Database to connect to | |
1376 | |
1377 ##### `user` | |
1378 | |
1379 Data type: `Optional[String[1]]` | |
1380 | |
1381 The user | |
1382 | |
1383 ##### `password` | |
1384 | |
1385 Data type: `Optional[String[1]]` | |
1386 | |
1387 The password | |
1388 | |
1389 ##### `sql` | |
1390 | |
1391 Data type: `String[1]` | |
1392 | |
1393 The SQL you want to execute | |
1394 |