From f0663f31908a1c45aa79e698fe1e031cf9c03f83 Mon Sep 17 00:00:00 2001 From: Eric Putnam Date: Tue, 3 Apr 2018 17:28:18 +0100 Subject: [PATCH 1/2] (PDOC-210) add Puppet Strings documentation Part of the Puppet Strings effort is having an example module out before version 2.0.0 is released. This adds 'correct' Strings documentation to this entire module and moves the Reference section of the README to REFERENCE.md. --- README.md | 904 +------------ REFERENCE.md | 1180 +++++++++++++++++ .../parser/functions/mysql_deepmerge.rb | 13 +- lib/puppet/parser/functions/mysql_dirname.rb | 10 +- lib/puppet/parser/functions/mysql_password.rb | 9 +- lib/puppet/type/mysql_database.rb | 7 +- lib/puppet/type/mysql_datadir.rb | 7 +- lib/puppet/type/mysql_grant.rb | 8 +- lib/puppet/type/mysql_plugin.rb | 11 +- lib/puppet/type/mysql_user.rb | 7 +- manifests/backup/mysqlbackup.pp | 6 +- manifests/backup/mysqldump.pp | 5 +- manifests/backup/xtrabackup.pp | 5 +- manifests/bindings.pp | 70 +- manifests/bindings/client_dev.pp | 6 +- manifests/bindings/daemon_dev.pp | 6 +- manifests/bindings/java.pp | 6 +- manifests/bindings/perl.pp | 6 +- manifests/bindings/php.pp | 6 +- manifests/bindings/python.pp | 6 +- manifests/bindings/ruby.pp | 6 +- manifests/client.pp | 20 + manifests/client/install.pp | 6 +- manifests/db.pp | 37 +- manifests/params.pp | 6 +- manifests/server.pp | 67 +- manifests/server/account_security.pp | 6 +- manifests/server/backup.pp | 58 +- manifests/server/binarylog.pp | 6 +- manifests/server/config.pp | 6 +- manifests/server/install.pp | 4 + manifests/server/installdb.pp | 4 + manifests/server/monitor.pp | 11 +- manifests/server/mysqltuner.pp | 11 + manifests/server/providers.pp | 9 +- manifests/server/root_password.pp | 4 + manifests/server/service.pp | 4 + 37 files changed, 1599 insertions(+), 944 deletions(-) create mode 100644 REFERENCE.md diff --git a/README.md b/README.md index 9d883dd54..cda01eba8 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ * [Specify passwords](#specify-passwords) * [Install Percona server on CentOS](#install-percona-server-on-centos) * [Install MariaDB on Ubuntu](#install-mariadb-on-ubuntu) -4. [Reference - An under-the-hood peek at what the module is doing and how](#reference) +4. [Reference - An under-the-hood peek at what the module is doing and how](REFERENCE.md) 5. [Limitations - OS compatibility, etc.](#limitations) 6. [Development - Guide for contributing to the module](#development) @@ -380,908 +380,6 @@ mysql::server::db: ``` - -## Reference - -### Classes - -#### Public classes - -* [`mysql::server`](#mysqlserver): Installs and configures MySQL. -* [`mysql::server::monitor`](#mysqlservermonitor): Sets up a monitoring user. -* [`mysql::server::mysqltuner`](#mysqlservermysqltuner): Installs MySQL tuner script. -* [`mysql::server::backup`](#mysqlserverbackup): Sets up MySQL backups via cron. -* [`mysql::bindings`](#mysqlbindings): Installs various MySQL language bindings. -* [`mysql::client`](#mysqlclient): Installs MySQL client (for non-servers). - -#### Private classes - -* `mysql::server::install`: Installs packages. -* `mysql::server::installdb`: Implements setup of mysqld data directory (e.g. /var/lib/mysql) -* `mysql::server::config`: Configures MYSQL. -* `mysql::server::service`: Manages service. -* `mysql::server::account_security`: Deletes default MySQL accounts. -* `mysql::server::root_password`: Sets MySQL root password. -* `mysql::server::providers`: Creates users, grants, and databases. -* `mysql::bindings::client_dev`: Installs MySQL client development package. -* `mysql::bindings::daemon_dev`: Installs MySQL daemon development package. -* `mysql::bindings::java`: Installs Java bindings. -* `mysql::bindings::perl`: Installs Perl bindings. -* `mysql::bindings::php`: Installs PHP bindings. -* `mysql::bindings::python`: Installs Python bindings. -* `mysql::bindings::ruby`: Installs Ruby bindings. -* `mysql::client::install`: Installs MySQL client. -* `mysql::backup::mysqldump`: Implements mysqldump backups. -* `mysql::backup::mysqlbackup`: Implements backups with Oracle MySQL Enterprise Backup. -* `mysql::backup::xtrabackup`: Implements backups with XtraBackup from Percona. - -### Parameters - -#### mysql::server - -##### `create_root_user` - -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. - -##### `create_root_my_cnf` - -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. - -##### `root_password` - -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. - -##### `old_root_password` - -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. - -##### `override_options` - -Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: - -```puppet -$override_options = { - 'section' => { - 'item' => 'thing', - } -} -``` - -See [**Customize Server Options**](#customize-server-options) above for usage details. - -##### `config_file` - -The location, as a path, of the MySQL configuration file. - -##### `manage_config_file` - -Whether the MySQL configuration file should be managed. - -Valid values are `true`, `false`. - -Defaults to `true`. - -##### `includedir` - -The location, as a path, of !includedir for custom configuration overrides. - -##### `install_options` - -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. - -##### `purge_conf_dir` - -Whether the `includedir` directory should be purged. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `restart` - -Whether the service should be restarted when things change. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `root_group` - -The name of the group used for root. Can be a group name or a group ID. See more about the [`group` file attribute](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). - -##### `mysql_group` - -The name of the group of the MySQL daemon user. Can be a group name or a group ID. See more about the [`group` file attribute](https://docs.puppetlabs.com/references/latest/type.html#file-attribute-group). - -##### `package_ensure` - -Whether the package exists or should be a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -Defaults to 'present'. - -##### `package_manage` - -Whether to manage the MySQL server package. - -Defaults to `true`. - -##### `package_name` - -The name of the MySQL server package to install. - -##### `remove_default_accounts` - -Specifies whether to automatically include `mysql::server::account_security`. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `service_enabled` - -Specifies whether the service should be enabled. - -Valid values are `true`, `false`. - -Defaults to `true`. - -##### `service_manage` - -Specifies whether the service should be managed. - -Valid values are `true`, `false`. - -Defaults to `true`. - -##### `service_name` - -The name of the MySQL server service. - -Defaults are OS dependent, defined in 'params.pp'. - -##### `service_provider` - -The provider to use to manage the service. - -For Ubuntu, defaults to 'upstart'; otherwise, default is undefined. - -##### `users` - -Optional hash of users to create, which are passed to [mysql_user](#mysql_user). - -```puppet -users => { - 'someuser@localhost' => { - ensure => 'present', - max_connections_per_hour => '0', - max_queries_per_hour => '0', - max_updates_per_hour => '0', - max_user_connections => '0', - password_hash => '*F3A2A51A9B0F2BE2468926B4132313728C250DBF', - tls_options => ['NONE'], - }, -} -``` - -##### `grants` - -Optional hash of grants, which are passed to [mysql_grant](#mysql_grant). - -```puppet -grants => { - 'someuser@localhost/somedb.*' => { - ensure => 'present', - options => ['GRANT'], - privileges => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'], - table => 'somedb.*', - user => 'someuser@localhost', - }, -} -``` - -##### `databases` - -Optional hash of databases to create, which are passed to [mysql_database](#mysql_database). - -```puppet -databases => { - 'somedb' => { - ensure => 'present', - charset => 'utf8', - }, -} -``` - -#### mysql::server::backup - -##### `backupuser` - -MySQL user to create for backups. - -##### `backuppassword` - -MySQL user password for backups. - -##### `backupdir` - -Directory in which to store backups. - -##### `backupdirmode` - -Permissions applied to the backup directory. This parameter is passed directly to the `file` resource. - -##### `backupdirowner` - -Owner for the backup directory. This parameter is passed directly to the `file` resource. - -##### `backupdirgroup` - -Group owner for the backup directory. This parameter is passed directly to the `file` resource. - -##### `backupcompress` - -Whether backups should be compressed. - -Valid values are `true`, `false`. - -Defaults to `true`. - -##### `backuprotate` - -How many days to keep backups. - -Valid value is an integer. - -Defaults to 30. - -##### `delete_before_dump` - -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. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `backupdatabases` - -Specifies an array of databases to back up. - -##### `file_per_database` - -Whether a separate file be used per database. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `include_routines` - -Whether or not to include routines for each database when doing a `file_per_database` backup. - -Defaults to `false`. - -##### `include_triggers` - -Whether or not to include triggers for each database when doing a `file_per_database` backup. - -Defaults to `false`. - -##### `ensure` - -Allows you to remove the backup scripts. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `execpath` - -Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. - -##### `time` - -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. - -#### mysql::server::backup - -##### `postscript` - -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. - -##### `prescript` - -A script that is executed before the backup begins. - -##### `provider` - -Sets the server backup implementation. Valid values are: - -* `mysqldump`: Implements backups with mysqldump. Backup type: Logical. This is the default value. -* `mysqlbackup`: Implements backups with MySQL Enterprise Backup from Oracle. Backup type: Physical. To use this type of backup, you'll need the `meb` package, which is available in RPM and TAR formats from Oracle. For Ubuntu, you can use [meb-deb](https://github.com/dveeden/meb-deb) to create a package from an official tarball. -* `xtrabackup`: Implements backups with XtraBackup from Percona. Backup type: Physical. - -##### `maxallowedpacket` - -Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. - -##### `optional_args` - -Specifies an array of optional arguments which should be passed through to the backup tool. (Currently only supported by the xtrabackup provider.) - -#### mysql::server::monitor - -##### `mysql_monitor_username` - -The username to create for MySQL monitoring. - -##### `mysql_monitor_password` - -The password to create for MySQL monitoring. - -##### `mysql_monitor_hostname` - -The hostname from which the monitoring user requests are allowed access. - -#### mysql::server::mysqltuner - -**Note**: If you're using this class on a non-network-connected system, you must download the mysqltuner.pl script and have it hosted somewhere accessible via `http(s)://`, `puppet://`, `ftp://`, or a fully qualified file path. - -##### `ensure` - -Ensures that the resource exists. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `version` - -The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. - -Defaults to 'v1.3.0'. - -##### `environment` - -Environment variables active during download, e.g. to download via proxies: environment => 'https_proxy=http://proxy.example.com:80' - -#### mysql::bindings - -##### `client_dev` - -Specifies whether `::mysql::bindings::client_dev` should be included. - -Valid values are `true`', `false`. - -Defaults to `false`. - -##### `daemon_dev` - -Specifies whether `::mysql::bindings::daemon_dev` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `java_enable` - -Specifies whether `::mysql::bindings::java` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `perl_enable` - -Specifies whether `mysql::bindings::perl` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `php_enable` - -Specifies whether `mysql::bindings::php` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `python_enable` - -Specifies whether `mysql::bindings::python` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `ruby_enable` - -Specifies whether `mysql::bindings::ruby` should be included. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `install_options` - -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). - -##### `client_dev_package_ensure` - -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`. - -##### `client_dev_package_name` - -The name of the client_dev package to install. - -Only applies if `client_dev => true`. - -##### `client_dev_package_provider` - -The provider to use to install the client_dev package. - -Only applies if `client_dev => true`. - -##### `daemon_dev_package_ensure` - -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`. - -##### `daemon_dev_package_name` - -The name of the daemon_dev package to install. - -Only applies if `daemon_dev => true`. - -##### `daemon_dev_package_provider` - -The provider to use to install the daemon_dev package. - -Only applies if `daemon_dev => true`. - -##### `java_package_ensure` - -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`. - -##### `java_package_name` - -The name of the Java package to install. - -Only applies if `java_enable => true`. - -##### `java_package_provider` - -The provider to use to install the Java package. - -Only applies if `java_enable => true`. - -##### `perl_package_ensure` - -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`. - -##### `perl_package_name` - -The name of the Perl package to install. - -Only applies if `perl_enable => true`. - -##### `perl_package_provider` - -The provider to use to install the Perl package. - -Only applies if `perl_enable => true`. - -##### `php_package_ensure` - -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`. - -##### `php_package_name` - -The name of the PHP package to install. - -Only applies if `php_enable => true`. - -##### `python_package_ensure` - -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`. - -##### `python_package_name` - -The name of the Python package to install. - -Only applies if `python_enable => true`. - -##### `python_package_provider` - -The provider to use to install the Python package. - -Only applies if `python_enable => true`. - -##### `ruby_package_ensure` - -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`. - -##### `ruby_package_name` - -The name of the Ruby package to install. - -Only applies if `ruby_enable => true`. - -##### `ruby_package_provider` - -What provider should be used to install the package. - -#### mysql::client - -##### `bindings_enable` - -Whether to automatically install all bindings. - -Valid values are `true`, `false`. - -Default to `false`. - -##### `install_options` - -Array of install options for managed package resources. You must pass the appropriate options for the package manager. - -##### `package_ensure` - -Whether the MySQL package should be present, absent, or a specific version. - -Valid values are 'present', 'absent', or 'x.y.z'. - -##### `package_manage` - -Whether to manage the MySQL client package. - -Defaults to `true`. - -##### `package_name` - -The name of the MySQL client package to install. - -### Defines - -#### mysql::db - -```puppet -mysql_database { 'information_schema': - ensure => 'present', - charset => 'utf8', - collate => 'utf8_swedish_ci', -} -mysql_database { 'mysql': - ensure => 'present', - charset => 'latin1', - collate => 'latin1_swedish_ci', -} -``` - -##### `user` - -The user for the database you're creating. - -##### `password` - -The password for $user for the database you're creating. - -##### `dbname` - -The name of the database to create. - -Defaults to "$name". - -##### `charset` - -The character set for the database. - -Defaults to 'utf8'. - -##### `collate` - -The collation for the database. - -Defaults to 'utf8_general_ci'. - -##### `host` - -The host to use as part of user@host for grants. - -Defaults to 'localhost'. - -##### `grant` - -The privileges to be granted for user@host on the database. - -Defaults to 'ALL'. - -##### `sql` - -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. - -Defaults to `undef`. - -##### `enforce_sql` - -Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once. - -Valid values are `true`, `false`. - -Defaults to `false`. - -##### `ensure` - -Specifies whether to create the database. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `import_timeout` - -Timeout, in seconds, for loading the sqlfiles. - -Defaults to 300. - -##### `import_cat_cmd` - -Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files. - -Defaults to 'cat'. - -### Types - -#### mysql_database - -`mysql_database` creates and manages databases within MySQL. - -##### `ensure` - -Whether the resource is present. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `name` - -The name of the MySQL database to manage. - -##### `charset` - -The CHARACTER SET setting for the database. - -Defaults to ':utf8'. - -##### `collate` - -The COLLATE setting for the database. - -Defaults to ':utf8_general_ci'. - -#### mysql_user - -Creates and manages user grants within MySQL. - -```puppet -mysql_user { 'root@127.0.0.1': - ensure => 'present', - max_connections_per_hour => '0', - max_queries_per_hour => '0', - max_updates_per_hour => '0', - max_user_connections => '0', -} -``` - -You can also specify an authentication plugin. - -```puppet -mysql_user{ 'myuser'@'localhost': - ensure => 'present', - plugin => 'unix_socket', -} -``` - -TLS options can be specified for a user. - -```puppet -mysql_user{ 'myuser'@'localhost': - ensure => 'present', - tls_options => ['SSL'], -} -``` - -##### `name` - -The name of the user, as 'username@hostname' or username@hostname. - -##### `password_hash` - -The user's password hash of the user. Use mysql_password() for creating such a hash. - -##### `max_user_connections` - -Maximum concurrent connections for the user. - -Must be an integer value. - -A value of '0' specifies no (or global) limit. - -##### `max_connections_per_hour` - -Maximum connections per hour for the user. - -Must be an integer value. - -A value of '0' specifies no (or global) limit. - -##### `max_queries_per_hour` - -Maximum queries per hour for the user. - -Must be an integer value. - -A value of '0' specifies no (or global) limit. - -##### `max_updates_per_hour` - -Maximum updates per hour for the user. - -Must be an integer value. - -A value of '0' specifies no (or global) limit. - -##### `tls_options` - -SSL-related options for a MySQL account, using one or more tls_option values. 'NONE' specifies that the account has no TLS options enforced, and the available options are 'SSL', 'X509', 'CIPHER *cipher*', 'ISSUER *issuer*', 'SUBJECT *subject*'; as stated in the MySQL documentation. - - -#### mysql_grant - -`mysql_grant` creates grant permissions to access databases within MySQL. To create grant permissions to access databases with MySQL, use it you must create the title of the resource as shown below, following the pattern of `username@hostname/database.table`: - -```puppet -mysql_grant { 'root@localhost/*.*': - ensure => 'present', - options => ['GRANT'], - privileges => ['ALL'], - table => '*.*', - user => 'root@localhost', -} -``` - -It is possible to specify privileges down to the column level: - -```puppet -mysql_grant { 'root@localhost/mysql.user': - ensure => 'present', - privileges => ['SELECT (Host, User)'], - table => 'mysql.user', - user => 'root@localhost', -} -``` - -To revoke GRANT privilege specify ['NONE']. - -##### `ensure` - -Whether the resource is present. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `name` - -Name to describe the grant. Must in a 'user/table' format. - -##### `privileges` - -Privileges to grant the user. - -##### `table` - -The table to which privileges are applied. - -##### `user` - -User to whom privileges are granted. - -##### `options` - -MySQL options to grant. Optional. - -#### mysql_plugin - -`mysql_plugin` can be used to load plugins into the MySQL Server. - -```puppet -mysql_plugin { 'auth_socket': - ensure => 'present', - soname => 'auth_socket.so', -} -``` - -##### `ensure` - -Whether the resource is present. - -Valid values are 'present', 'absent'. - -Defaults to 'present'. - -##### `name` - -The name of the MySQL plugin to manage. - -##### `soname` - -The library file name. - -#### `mysql_datadir` - -Initializes the MySQL data directory with version specific code. Pre MySQL 5.7.6 it uses mysql_install_db. After MySQL 5.7.6 it uses mysqld --initialize-insecure. - -Insecure initialization is needed, as mysqld version 5.7 introduced 'secure by default' mode. This means MySQL generates a random password and writes it to STDOUT. This means puppet can never access the database server afterwards, as no credentials are available. - -This type is an internal type and should not be called directly. - -### Facts - -#### `mysql_version` - -Determines the MySQL version by parsing the output from `mysql --version` - -#### `mysql_server_id` - -Generates a unique id, based on the node's MAC address, which can be used as `server_id`. This fact will *always* return `0` on nodes that have only loopback interfaces. Because those nodes aren't connected to the outside world, this shouldn't cause any conflicts. - ### Tasks The MySQL module has an example task that allows a user to execute arbitary SQL against a database. Please refer to to the [PE documentation](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html) or [Bolt documentation](https://puppet.com/docs/bolt/latest/bolt.html) on how to execute a task. diff --git a/REFERENCE.md b/REFERENCE.md new file mode 100644 index 000000000..07a217dde --- /dev/null +++ b/REFERENCE.md @@ -0,0 +1,1180 @@ +# Reference + +## Classes + +### Public Classes + +* [`mysql::bindings`](#mysqlbindings): Parent class for MySQL bindings. +* [`mysql::client`](#mysqlclient): Installs and configures the MySQL client. +* [`mysql::server`](#mysqlserver): Installs and configures the MySQL server. +* [`mysql::server::backup`](#mysqlserverbackup): Create and manage a MySQL backup. +* [`mysql::server::monitor`](#mysqlservermonitor): This is a helper class to add a monitoring user to the database +* [`mysql::server::mysqltuner`](#mysqlservermysqltuner): Manage the MySQLTuner package. + +### Private Classes + +* `mysql::backup::mysqlbackup`: Manage the mysqlbackup client. +* `mysql::backup::mysqldump`: "Provider" for mysqldump +* `mysql::backup::xtrabackup`: "Provider" for Percona XtraBackup +* `mysql::bindings::client_dev`: Private class for installing client development bindings +* `mysql::bindings::daemon_dev`: Private class for installing daemon development bindings +* `mysql::bindings::java`: Private class for installing java language bindings. +* `mysql::bindings::perl`: Private class for installing perl language bindings. +* `mysql::bindings::php`: Private class for installing php language bindings +* `mysql::bindings::python`: Private class for installing python language bindings +* `mysql::bindings::ruby`: Private class for installing ruby language bindings +* `mysql::client::install`: Private class for MySQL client install. +* `mysql::params`: Params class. +* `mysql::server::account_security`: Private class for ensuring localhost accounts do not exist +* `mysql::server::binarylog`: Binary log configuration requires the mysql user to be present. This must be done after package install +* `mysql::server::config`: Private class for MySQL server configuration. +* `mysql::server::install`: Private class for managing MySQL package. +* `mysql::server::installdb`: Builds initial databases on installation. +* `mysql::server::providers`: Convenience class to call each of the three providers with the corresponding +hashes provided in mysql::server. +* `mysql::server::root_password`: Private class for managing the root password +* `mysql::server::service`: Private class for managing the MySQL service + +## Defined types + +* [`mysql::db`](#mysqldb): Create and configure a MySQL database. + +## Resource types + +### Public Resource types + +* [`mysql_plugin`](#mysql_plugin): Manage MySQL plugins. + +### Private Resource types + +* `mysql_database`: Manage a MySQL database. +* `mysql_datadir`: Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above). +* `mysql_grant`: Manage a MySQL user's rights. +* `mysql_user`: Manage a MySQL user. This includes management of users password as well as privileges. + +## Functions + +* [`mysql_deepmerge`](#mysql_deepmerge): Recursively merges two or more hashes together and returns the resulting hash. +* [`mysql_dirname`](#mysql_dirname): Returns the dirname of a path +* [`mysql_password`](#mysql_password): Hash a string as mysql's "PASSWORD()" function would do it +* [`mysql_strip_hash`](#mysql_strip_hash): TEMPORARY FUNCTION: EXPIRES 2014-03-10 When given a hash this function strips out all blank entries. + +## Tasks + +* [`export`](#export): Allows you to backup your database to local file. +* [`sql`](#sql): Allows you to execute arbitary SQL + +## Classes + +### mysql::bindings + +Parent class for MySQL bindings. + +#### Examples + +##### Install Ruby language bindings + +```puppet +class { 'mysql::bindings': + ruby_enable => true, + ruby_package_ensure => 'present', + ruby_package_name => 'ruby-mysql-2.7.1-1mdv2007.0.sparc.rpm', + ruby_package_provider => 'rpm', +} +``` + +#### Parameters + +The following parameters are available in the `mysql::bindings` class. + +##### `install_options` + +Data type: `Any` + +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). + +Default value: `undef` + +##### `java_enable` + +Data type: `Any` + +Specifies whether `::mysql::bindings::java` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `perl_enable` + +Data type: `Any` + +Specifies whether `mysql::bindings::perl` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `php_enable` + +Data type: `Any` + +Specifies whether `mysql::bindings::php` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `python_enable` + +Data type: `Any` + +Specifies whether `mysql::bindings::python` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `ruby_enable` + +Data type: `Any` + +Specifies whether `mysql::bindings::ruby` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `client_dev` + +Data type: `Any` + +Specifies whether `::mysql::bindings::client_dev` should be included. Valid values are `true`', `false`. + +Default value: `false` + +##### `daemon_dev` + +Data type: `Any` + +Specifies whether `::mysql::bindings::daemon_dev` should be included. Valid values are `true`, `false`. + +Default value: `false` + +##### `java_package_ensure` + +Data type: `Any` + +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`. + +Default value: $mysql::params::java_package_ensure + +##### `java_package_name` + +Data type: `Any` + +The name of the Java package to install. Only applies if `java_enable => true`. + +Default value: $mysql::params::java_package_name + +##### `java_package_provider` + +Data type: `Any` + +The provider to use to install the Java package. Only applies if `java_enable => true`. + +Default value: $mysql::params::java_package_provider + +##### `perl_package_ensure` + +Data type: `Any` + +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`. + +Default value: $mysql::params::perl_package_ensure + +##### `perl_package_name` + +Data type: `Any` + +The name of the Perl package to install. Only applies if `perl_enable => true`. + +Default value: $mysql::params::perl_package_name + +##### `perl_package_provider` + +Data type: `Any` + +The provider to use to install the Perl package. Only applies if `perl_enable => true`. + +Default value: $mysql::params::perl_package_provider + +##### `php_package_ensure` + +Data type: `Any` + +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`. + +Default value: $mysql::params::php_package_ensure + +##### `php_package_name` + +Data type: `Any` + +The name of the PHP package to install. Only applies if `php_enable => true`. + +Default value: $mysql::params::php_package_name + +##### `php_package_provider` + +Data type: `Any` + +The provider to use to install the PHP package. Only applies if `php_enable => true`. + +Default value: $mysql::params::php_package_provider + +##### `python_package_ensure` + +Data type: `Any` + +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`. + +Default value: $mysql::params::python_package_ensure + +##### `python_package_name` + +Data type: `Any` + +The name of the Python package to install. Only applies if `python_enable => true`. + +Default value: $mysql::params::python_package_name + +##### `python_package_provider` + +Data type: `Any` + +The provider to use to install the Python package. Only applies if `python_enable => true`. + +Default value: $mysql::params::python_package_provider + +##### `ruby_package_ensure` + +Data type: `Any` + +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`. + +Default value: $mysql::params::ruby_package_ensure + +##### `ruby_package_name` + +Data type: `Any` + +The name of the Ruby package to install. Only applies if `ruby_enable => true`. + +Default value: $mysql::params::ruby_package_name + +##### `ruby_package_provider` + +Data type: `Any` + +What provider should be used to install the package. + +Default value: $mysql::params::ruby_package_provider + +##### `client_dev_package_ensure` + +Data type: `Any` + +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`. + +Default value: $mysql::params::client_dev_package_ensure + +##### `client_dev_package_name` + +Data type: `Any` + +The name of the client_dev package to install. Only applies if `client_dev => true`. + +Default value: $mysql::params::client_dev_package_name + +##### `client_dev_package_provider` + +Data type: `Any` + +The provider to use to install the client_dev package. Only applies if `client_dev => true`. + +Default value: $mysql::params::client_dev_package_provider + +##### `daemon_dev_package_ensure` + +Data type: `Any` + +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`. + +Default value: $mysql::params::daemon_dev_package_ensure + +##### `daemon_dev_package_name` + +Data type: `Any` + +The name of the daemon_dev package to install. Only applies if `daemon_dev => true`. + +Default value: $mysql::params::daemon_dev_package_name + +##### `daemon_dev_package_provider` + +Data type: `Any` + +The provider to use to install the daemon_dev package. Only applies if `daemon_dev => true`. + +Default value: $mysql::params::daemon_dev_package_provider + +### mysql::client + +Installs and configures the MySQL client. + +#### Examples + +##### Install the MySQL client + +```puppet +class {'::mysql::client': + package_name => 'mysql-client', + package_ensure => 'present', + bindings_enable => true, +} +``` + +#### Parameters + +The following parameters are available in the `mysql::client` class. + +##### `bindings_enable` + +Data type: `Any` + +Whether to automatically install all bindings. Valid values are `true`, `false`. Default to `false`. + +Default value: $mysql::params::bindings_enable + +##### `install_options` + +Data type: `Any` + +Array of install options for managed package resources. You must pass the appropriate options for the package manager. + +Default value: `undef` + +##### `package_ensure` + +Data type: `Any` + +Whether the MySQL package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. + +Default value: $mysql::params::client_package_ensure + +##### `package_manage` + +Data type: `Any` + +Whether to manage the MySQL client package. Defaults to `true`. + +Default value: $mysql::params::client_package_manage + +##### `package_name` + +Data type: `Any` + +The name of the MySQL client package to install. + +Default value: $mysql::params::client_package_name + +### mysql::server + +Installs and configures the MySQL server. + +#### Examples + +##### Install MySQL Server + +```puppet +class { '::mysql::server': + package_name => 'mysql-server', + package_ensure => '5.7.1+mysql~trusty', + root_password => 'strongpassword', + remove_default_accounts => true, +} +``` + +#### Parameters + +The following parameters are available in the `mysql::server` class. + +##### `config_file` + +Data type: `Any` + +The location, as a path, of the MySQL configuration file. + +Default value: $mysql::params::config_file + +##### `includedir` + +Data type: `Any` + +The location, as a path, of !includedir for custom configuration overrides. + +Default value: $mysql::params::includedir + +##### `install_options` + +Data type: `Any` + +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 + +Default value: `undef` + +##### `install_secret_file` + +Data type: `Any` + +Path to secret file containing temporary root password. + +Default value: $mysql::params::install_secret_file + +##### `manage_config_file` + +Data type: `Any` + +Whether the MySQL configuration file should be managed. Valid values are `true`, `false`. Defaults to `true`. + +Default value: $mysql::params::manage_config_file + +##### `override_options` + +Data type: `Any` + +Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: See above for usage details. + +Default value: {} + +##### `package_ensure` + +Data type: `Any` + +Whether the package exists or should be a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Defaults to 'present'. + +Default value: $mysql::params::server_package_ensure + +##### `package_manage` + +Data type: `Any` + +Whether to manage the MySQL server package. Defaults to `true`. + +Default value: $mysql::params::server_package_manage + +##### `package_name` + +Data type: `Any` + +The name of the MySQL server package to install. + +Default value: $mysql::params::server_package_name + +##### `purge_conf_dir` + +Data type: `Any` + +Whether the `includedir` directory should be purged. Valid values are `true`, `false`. Defaults to `false`. + +Default value: $mysql::params::purge_conf_dir + +##### `remove_default_accounts` + +Data type: `Any` + +Specifies whether to automatically include `mysql::server::account_security`. Valid values are `true`, `false`. Defaults to `false`. + +Default value: `false` + +##### `restart` + +Data type: `Any` + +Whether the service should be restarted when things change. Valid values are `true`, `false`. Defaults to `false`. + +Default value: $mysql::params::restart + +##### `root_group` + +Data type: `Any` + +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). + +Default value: $mysql::params::root_group + +##### `mysql_group` + +Data type: `Any` + +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). + +Default value: $mysql::params::mysql_group + +##### `root_password` + +Data type: `Any` + +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. + +Default value: $mysql::params::root_password + +##### `service_enabled` + +Data type: `Any` + +Specifies whether the service should be enabled. Valid values are `true`, `false`. Defaults to `true`. + +Default value: $mysql::params::server_service_enabled + +##### `service_manage` + +Data type: `Any` + +Specifies whether the service should be managed. Valid values are `true`, `false`. Defaults to `true`. + +Default value: $mysql::params::server_service_manage + +##### `service_name` + +Data type: `Any` + +The name of the MySQL server service. Defaults are OS dependent, defined in 'params.pp'. + +Default value: $mysql::params::server_service_name + +##### `service_provider` + +Data type: `Any` + +The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined. + +Default value: $mysql::params::server_service_provider + +##### `create_root_user` + +Data type: `Any` + +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. + +Default value: $mysql::params::create_root_user + +##### `create_root_my_cnf` + +Data type: `Any` + +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. + +Default value: $mysql::params::create_root_my_cnf + +##### `users` + +Data type: `Any` + +Optional hash of users to create, which are passed to [mysql_user](#mysql_user). + +Default value: {} + +##### `grants` + +Data type: `Any` + +Optional hash of grants, which are passed to [mysql_grant](#mysql_grant). + +Default value: {} + +##### `databases` + +Data type: `Any` + +Optional hash of databases to create, which are passed to [mysql_database](#mysql_database). + +Default value: {} + +##### `enabled` + +Data type: `Any` + +_Deprecated_ + +Default value: `undef` + +##### `manage_service` + +Data type: `Any` + +_Deprecated_ + +Default value: `undef` + +##### `old_root_password` + +Data type: `Any` + +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. + +Default value: `undef` + +### mysql::server::backup + +Create and manage a MySQL backup. + +#### Examples + +##### Create a basic MySQL backup: + +```puppet +class { 'mysql::server': + root_password => 'password' +} +class { 'mysql::server::backup': + backupuser => 'myuser', + backuppassword => 'mypassword', + backupdir => '/tmp/backups', +} +``` + +#### Parameters + +The following parameters are available in the `mysql::server::backup` class. + +##### `backupuser` + +Data type: `Any` + +MySQL user with backup administrator privileges. + +Default value: `undef` + +##### `backuppassword` + +Data type: `Any` + +Password for `backupuser`. + +Default value: `undef` + +##### `backupdir` + +Data type: `Any` + +Directory to store backup. + +Default value: `undef` + +##### `backupdirmode` + +Data type: `Any` + +Permissions applied to the backup directory. This parameter is passed directly to the file resource. + +Default value: '0700' + +##### `backupdirowner` + +Data type: `Any` + +Owner for the backup directory. This parameter is passed directly to the file resource. + +Default value: 'root' + +##### `backupdirgroup` + +Data type: `Any` + +Group owner for the backup directory. This parameter is passed directly to the file resource. + +Default value: 'root' + +##### `backupcompress` + +Data type: `Any` + +Whether or not to compress the backup (when using the mysqldump provider) + +Default value: `true` + +##### `backuprotate` + +Data type: `Any` + +Backup rotation interval in 24 hour periods. + +Default value: 30 + +##### `ignore_events` + +Data type: `Any` + +Ignore the mysql.event table. + +Default value: `true` + +##### `delete_before_dump` + +Data type: `Any` + +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. + +Default value: `false` + +##### `backupdatabases` + +Data type: `Any` + +Databases to backup (if using xtrabackup provider). + +Default value: [] + +##### `file_per_database` + +Data type: `Any` + +Use file per database mode creating one file per database backup. + +Default value: `false` + +##### `include_routines` + +Data type: `Any` + +Dump stored routines (procedures and functions) from dumped databases when doing a `file_per_database` backup. + +Default value: `false` + +##### `include_triggers` + +Data type: `Any` + +Dump triggers for each dumped table when doing a `file_per_database` backup. + +Default value: `false` + +##### `ensure` + +Data type: `Any` + + + +Default value: 'present' + +##### `time` + +Data type: `Any` + +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. + +Default value: ['23', '5'] + +##### `prescript` + +Data type: `Any` + +A script that is executed before the backup begins. + +Default value: `false` + +##### `postscript` + +Data type: `Any` + +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. + +Default value: `false` + +##### `execpath` + +Data type: `Any` + +Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. + +Default value: '/usr/bin:/usr/sbin:/bin:/sbin' + +##### `provider` + +Data type: `Any` + +Sets the server backup implementation. Valid values are: + +Default value: 'mysqldump' + +##### `maxallowedpacket` + +Data type: `Any` + +Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. + +Default value: '1M' + +##### `optional_args` + +Data type: `Any` + +Specifies an array of optional arguments which should be passed through to the backup tool. (Currently only supported by the xtrabackup provider.) + +Default value: [] + +### mysql::server::monitor + +This is a helper class to add a monitoring user to the database + +#### Parameters + +The following parameters are available in the `mysql::server::monitor` class. + +##### `mysql_monitor_username` + +Data type: `Any` + +The username to create for MySQL monitoring. + +Default value: '' + +##### `mysql_monitor_password` + +Data type: `Any` + +The password to create for MySQL monitoring. + +Default value: '' + +##### `mysql_monitor_hostname` + +Data type: `Any` + +The hostname from which the monitoring user requests are allowed access. + +Default value: '' + +### mysql::server::mysqltuner + +Manage the MySQLTuner package. + +#### Parameters + +The following parameters are available in the `mysql::server::mysqltuner` class. + +##### `ensure` + +Data type: `Any` + +Ensures that the resource exists. Valid values are 'present', 'absent'. Defaults to 'present'. + +Default value: 'present' + +##### `version` + +Data type: `Any` + +The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. Defaults to 'v1.3.0'. + +Default value: 'v1.3.0' + +##### `source` + +Data type: `Any` + +Source path for the mysqltuner package. + +Default value: `undef` + +##### `environment` + +Data type: `Any` + +Environment variables active during download, e.g. to download via proxies: environment => 'https_proxy=http://proxy.example.com:80' + +Default value: `undef` + +## Defined types + +### mysql::db + +Create and configure a MySQL database. + +#### Examples + +##### Create a database + +```puppet +mysql::db { 'mydb': + user => 'myuser', + password => 'mypass', + host => 'localhost', + grant => ['SELECT', 'UPDATE'], +} +``` + +#### Parameters + +The following parameters are available in the `mysql::db` defined type. + +##### `user` + +Data type: `Any` + +The user for the database you're creating. + +##### `password` + +Data type: `Any` + +The password for $user for the database you're creating. + +##### `dbname` + +Data type: `Any` + +The name of the database to create. + +Default value: $name + +##### `charset` + +Data type: `Any` + +The character set for the database. + +Default value: 'utf8' + +##### `collate` + +Data type: `Any` + +The collation for the database. + +Default value: 'utf8_general_ci' + +##### `host` + +Data type: `Any` + +The host to use as part of user@host for grants. + +Default value: 'localhost' + +##### `grant` + +Data type: `Any` + +The privileges to be granted for user@host on the database. + +Default value: 'ALL' + +##### `sql` + +Data type: `Optional[Variant[Array, Hash, String]]` + +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. + +Default value: `undef` + +##### `enforce_sql` + +Data type: `Any` + +Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once. + +Default value: `false` + +##### `ensure` + +Data type: `Enum['absent', 'present']` + +Specifies whether to create the database. Valid values are 'present', 'absent'. Defaults to 'present'. + +Default value: 'present' + +##### `import_timeout` + +Data type: `Any` + +Timeout, in seconds, for loading the sqlfiles. Defaults to 300. + +Default value: 300 + +##### `import_cat_cmd` + +Data type: `Any` + +Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files. + +Default value: 'cat' + +## Resource types + +### mysql_plugin + +Manage MySQL plugins. + +#### Examples + +##### + +```puppet +mysql_plugin { 'some_plugin': + soname => 'some_pluginlib.so', +} +``` + +#### Properties + +The following properties are available in the `mysql_plugin` type. + +##### `ensure` + +Valid values: present, absent + +The basic property that the resource should be in. + +Default value: present + +##### `soname` + +Valid values: %r{^\w+\.\w+$} + +The name of the library + +#### Parameters + +The following parameters are available in the `mysql_plugin` type. + +##### `name` + +namevar + +The name of the MySQL plugin to manage. + +## Functions + +### mysql_deepmerge + +Type: Ruby 3.x API + +- When there is a duplicate key that is a hash, they are recursively merged. +- When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." +- When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), + the rightmost style will win. + +#### `mysql_deepmerge()` + +- When there is a duplicate key that is a hash, they are recursively merged. +- When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." +- When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), + the rightmost style will win. + +Returns: `Hash` + +### mysql_dirname + +Type: Ruby 3.x API + +Returns the dirname of a path + +#### `mysql_dirname(String $path)` + +Returns: `String` Directory name of path. + +##### `path` + +Data type: `String` + +Path to find the dirname for. + +### mysql_password + +Type: Ruby 3.x API + +Hash a string as mysql's "PASSWORD()" function would do it + +#### `mysql_password(String $password)` + +Returns: `String` the mysql password hash from the clear text password. + +##### `password` + +Data type: `String` + +Plain text password. + +### mysql_strip_hash + +Type: Ruby 3.x API + +TEMPORARY FUNCTION: EXPIRES 2014-03-10 +When given a hash this function strips out all blank entries. + +#### `mysql_strip_hash()` + +TEMPORARY FUNCTION: EXPIRES 2014-03-10 +When given a hash this function strips out all blank entries. + +Returns: `Any` + +## Tasks + +### export + +Allows you to backup your database to local file. + +**Supports noop?** false + +#### Parameters + +##### `database` + +Data type: `Optional[String[1]]` + +Database to connect to + +##### `user` + +Data type: `Optional[String[1]]` + +The user + +##### `password` + +Data type: `Optional[String[1]]` + +The password + +##### `file` + +Data type: `String[1]` + +Path to file you want backup to + +### sql + +Allows you to execute arbitary SQL + +**Supports noop?** false + +#### Parameters + +##### `database` + +Data type: `Optional[String[1]]` + +Database to connect to + +##### `user` + +Data type: `Optional[String[1]]` + +The user + +##### `password` + +Data type: `Optional[String[1]]` + +The password + +##### `sql` + +Data type: `String[1]` + +The SQL you want to execute + diff --git a/lib/puppet/parser/functions/mysql_deepmerge.rb b/lib/puppet/parser/functions/mysql_deepmerge.rb index 97d10229b..766028e89 100644 --- a/lib/puppet/parser/functions/mysql_deepmerge.rb +++ b/lib/puppet/parser/functions/mysql_deepmerge.rb @@ -1,21 +1,20 @@ -# Recursively merges two or more hashes together and returns the resulting hash. module Puppet::Parser::Functions newfunction(:mysql_deepmerge, type: :rvalue, doc: <<-'ENDHEREDOC') do |args| - Recursively merges two or more hashes together and returns the resulting hash. - - For example: + @summary Recursively merges two or more hashes together and returns the resulting hash. + @example $hash1 = {'one' => 1, 'two' => 2, 'three' => { 'four' => 4 } } $hash2 = {'two' => 'dos', 'three' => { 'five' => 5 } } $merged_hash = mysql_deepmerge($hash1, $hash2) # The resulting hash is equivalent to: # $merged_hash = { 'one' => 1, 'two' => 'dos', 'three' => { 'four' => 4, 'five' => 5 } } - When there is a duplicate key that is a hash, they are recursively merged. - When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." - When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), + - When there is a duplicate key that is a hash, they are recursively merged. + - When there is a duplicate key that is not a hash, the key in the rightmost hash will "win." + - When there are conficting uses of dashes and underscores in two keys (which mysql would otherwise equate), the rightmost style will win. + @return [Hash] ENDHEREDOC if args.length < 2 diff --git a/lib/puppet/parser/functions/mysql_dirname.rb b/lib/puppet/parser/functions/mysql_dirname.rb index e1a21202d..40a8ad64f 100644 --- a/lib/puppet/parser/functions/mysql_dirname.rb +++ b/lib/puppet/parser/functions/mysql_dirname.rb @@ -1,7 +1,13 @@ -# Returns the dirname of a path. module Puppet::Parser::Functions newfunction(:mysql_dirname, type: :rvalue, doc: <<-EOS - Returns the dirname of a path. + @summary + Returns the dirname of a path + + @param [String] path + Path to find the dirname for. + + @return [String] + Directory name of path. EOS ) do |arguments| diff --git a/lib/puppet/parser/functions/mysql_password.rb b/lib/puppet/parser/functions/mysql_password.rb index 4169bf433..53ba580b2 100644 --- a/lib/puppet/parser/functions/mysql_password.rb +++ b/lib/puppet/parser/functions/mysql_password.rb @@ -1,9 +1,12 @@ require 'digest/sha1' -# Returns the mysql password hash from the clear text password. -# Hash a string as mysql's "PASSWORD()" function would do it module Puppet::Parser::Functions newfunction(:mysql_password, type: :rvalue, doc: <<-EOS - Returns the mysql password hash from the clear text password. + @summary + Hash a string as mysql's "PASSWORD()" function would do it + + @param [String] password Plain text password. + + @return [String] the mysql password hash from the clear text password. EOS ) do |args| diff --git a/lib/puppet/type/mysql_database.rb b/lib/puppet/type/mysql_database.rb index f8b940650..817f04257 100644 --- a/lib/puppet/type/mysql_database.rb +++ b/lib/puppet/type/mysql_database.rb @@ -1,5 +1,10 @@ Puppet::Type.newtype(:mysql_database) do - @doc = 'Manage MySQL databases.' + @doc = <<-PUPPET + @summary + Manage a MySQL database. + + @api private + PUPPET ensurable diff --git a/lib/puppet/type/mysql_datadir.rb b/lib/puppet/type/mysql_datadir.rb index e49a41195..7945f4e30 100644 --- a/lib/puppet/type/mysql_datadir.rb +++ b/lib/puppet/type/mysql_datadir.rb @@ -1,5 +1,10 @@ Puppet::Type.newtype(:mysql_datadir) do - @doc = 'Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above).' + @doc = <<-PUPPET + @summary + Manage MySQL datadirs with mysql_install_db OR mysqld (5.7.6 and above). + + @api private + PUPPET ensurable diff --git a/lib/puppet/type/mysql_grant.rb b/lib/puppet/type/mysql_grant.rb index c8929d8dc..ea1db177d 100644 --- a/lib/puppet/type/mysql_grant.rb +++ b/lib/puppet/type/mysql_grant.rb @@ -1,6 +1,10 @@ -# This has to be a separate type to enable collecting Puppet::Type.newtype(:mysql_grant) do - @doc = "Manage a MySQL user's rights." + @doc = <<-PUPPET + @summary + Manage a MySQL user's rights. + + @api private + PUPPET ensurable autorequire(:file) { '/root/.my.cnf' } diff --git a/lib/puppet/type/mysql_plugin.rb b/lib/puppet/type/mysql_plugin.rb index 029220e18..433146e69 100644 --- a/lib/puppet/type/mysql_plugin.rb +++ b/lib/puppet/type/mysql_plugin.rb @@ -1,5 +1,14 @@ Puppet::Type.newtype(:mysql_plugin) do - @doc = 'Manage MySQL plugins.' + @doc = <<-PUPPET + @summary + Manage MySQL plugins. + + @example + mysql_plugin { 'some_plugin': + soname => 'some_pluginlib.so', + } + + PUPPET ensurable diff --git a/lib/puppet/type/mysql_user.rb b/lib/puppet/type/mysql_user.rb index 8a564edd6..10dfae7c0 100644 --- a/lib/puppet/type/mysql_user.rb +++ b/lib/puppet/type/mysql_user.rb @@ -1,6 +1,11 @@ # This has to be a separate type to enable collecting Puppet::Type.newtype(:mysql_user) do - @doc = 'Manage a MySQL user. This includes management of users password as well as privileges.' + @doc = <<-PUPPET + @summary + Manage a MySQL user. This includes management of users password as well as privileges. + + @api private + PUPPET ensurable diff --git a/manifests/backup/mysqlbackup.pp b/manifests/backup/mysqlbackup.pp index 08a5cc1d7..3a2c56a4d 100644 --- a/manifests/backup/mysqlbackup.pp +++ b/manifests/backup/mysqlbackup.pp @@ -1,4 +1,8 @@ -# See README.me for usage. +# @summary +# Manage the mysqlbackup client. +# +# @api private +# class mysql::backup::mysqlbackup ( $backupuser = '', $backuppassword = '', diff --git a/manifests/backup/mysqldump.pp b/manifests/backup/mysqldump.pp index e8988dfc4..73e79ee72 100644 --- a/manifests/backup/mysqldump.pp +++ b/manifests/backup/mysqldump.pp @@ -1,4 +1,7 @@ -# See README.me for usage. +# @summary +# "Provider" for mysqldump +# @api private +# class mysql::backup::mysqldump ( $backupuser = '', $backuppassword = '', diff --git a/manifests/backup/xtrabackup.pp b/manifests/backup/xtrabackup.pp index e0365588a..b1d34d894 100644 --- a/manifests/backup/xtrabackup.pp +++ b/manifests/backup/xtrabackup.pp @@ -1,4 +1,7 @@ -# See README.me for usage. +# @summary +# "Provider" for Percona XtraBackup +# @api private +# class mysql::backup::xtrabackup ( $xtrabackup_package_name = $mysql::params::xtrabackup_package_name, $backupuser = undef, diff --git a/manifests/bindings.pp b/manifests/bindings.pp index 3fd9c74a3..a6565ce2a 100644 --- a/manifests/bindings.pp +++ b/manifests/bindings.pp @@ -1,4 +1,72 @@ -# See README.md. +# @summary +# Parent class for MySQL bindings. +# +# @example Install Ruby language bindings +# class { 'mysql::bindings': +# ruby_enable => true, +# ruby_package_ensure => 'present', +# ruby_package_name => 'ruby-mysql-2.7.1-1mdv2007.0.sparc.rpm', +# ruby_package_provider => 'rpm', +# } +# @param install_options +# 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). +# @param java_enable +# Specifies whether `::mysql::bindings::java` should be included. Valid values are `true`, `false`. +# @param perl_enable +# Specifies whether `mysql::bindings::perl` should be included. Valid values are `true`, `false`. +# @param php_enable +# Specifies whether `mysql::bindings::php` should be included. Valid values are `true`, `false`. +# @param python_enable +# Specifies whether `mysql::bindings::python` should be included. Valid values are `true`, `false`. +# @param ruby_enable +# Specifies whether `mysql::bindings::ruby` should be included. Valid values are `true`, `false`. +# @param client_dev +# Specifies whether `::mysql::bindings::client_dev` should be included. Valid values are `true`', `false`. +# @param daemon_dev +# Specifies whether `::mysql::bindings::daemon_dev` should be included. Valid values are `true`, `false`. +# @param java_package_ensure +# 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`. +# @param java_package_name +# The name of the Java package to install. Only applies if `java_enable => true`. +# @param java_package_provider +# The provider to use to install the Java package. Only applies if `java_enable => true`. +# @param perl_package_ensure +# 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`. +# @param perl_package_name +# The name of the Perl package to install. Only applies if `perl_enable => true`. +# @param perl_package_provider +# The provider to use to install the Perl package. Only applies if `perl_enable => true`. +# @param php_package_ensure +# 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`. +# @param php_package_name +# The name of the PHP package to install. Only applies if `php_enable => true`. +# @param php_package_provider +# The provider to use to install the PHP package. Only applies if `php_enable => true`. +# @param python_package_ensure +# 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`. +# @param python_package_name +# The name of the Python package to install. Only applies if `python_enable => true`. +# @param python_package_provider +# The provider to use to install the Python package. Only applies if `python_enable => true`. +# @param ruby_package_ensure +# 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`. +# @param ruby_package_name +# The name of the Ruby package to install. Only applies if `ruby_enable => true`. +# @param ruby_package_provider +# What provider should be used to install the package. +# @param client_dev_package_ensure +# 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`. +# @param client_dev_package_name +# The name of the client_dev package to install. Only applies if `client_dev => true`. +# @param client_dev_package_provider +# The provider to use to install the client_dev package. Only applies if `client_dev => true`. +# @param daemon_dev_package_ensure +# 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`. +# @param daemon_dev_package_name +# The name of the daemon_dev package to install. Only applies if `daemon_dev => true`. +# @param daemon_dev_package_provider +# The provider to use to install the daemon_dev package. Only applies if `daemon_dev => true`. +# class mysql::bindings ( $install_options = undef, # Boolean to determine if we should include the classes. diff --git a/manifests/bindings/client_dev.pp b/manifests/bindings/client_dev.pp index dc249e158..9e88946db 100644 --- a/manifests/bindings/client_dev.pp +++ b/manifests/bindings/client_dev.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing client development bindings +# +# @api private +# class mysql::bindings::client_dev { if $mysql::bindings::client_dev_package_name { diff --git a/manifests/bindings/daemon_dev.pp b/manifests/bindings/daemon_dev.pp index 44caaafc1..48a936e32 100644 --- a/manifests/bindings/daemon_dev.pp +++ b/manifests/bindings/daemon_dev.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing daemon development bindings +# +# @api private +# class mysql::bindings::daemon_dev { if $mysql::bindings::daemon_dev_package_name { diff --git a/manifests/bindings/java.pp b/manifests/bindings/java.pp index db93ac282..23e3aa566 100644 --- a/manifests/bindings/java.pp +++ b/manifests/bindings/java.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing java language bindings. +# +# @api private +# class mysql::bindings::java { package { 'mysql-connector-java': diff --git a/manifests/bindings/perl.pp b/manifests/bindings/perl.pp index 99d429c46..9ef13b9bc 100644 --- a/manifests/bindings/perl.pp +++ b/manifests/bindings/perl.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing perl language bindings. +# +# @api private +# class mysql::bindings::perl { package{ 'perl_mysql': diff --git a/manifests/bindings/php.pp b/manifests/bindings/php.pp index 9af706962..36c914921 100644 --- a/manifests/bindings/php.pp +++ b/manifests/bindings/php.pp @@ -1,4 +1,8 @@ -# Private class: See README.md +# @summary +# Private class for installing php language bindings +# +# @api private +# class mysql::bindings::php { package { 'php-mysql': diff --git a/manifests/bindings/python.pp b/manifests/bindings/python.pp index a44c8fa15..1c2494ac5 100644 --- a/manifests/bindings/python.pp +++ b/manifests/bindings/python.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing python language bindings +# +# @api private +# class mysql::bindings::python { package { 'python-mysqldb': diff --git a/manifests/bindings/ruby.pp b/manifests/bindings/ruby.pp index d431efedc..1630265fb 100644 --- a/manifests/bindings/ruby.pp +++ b/manifests/bindings/ruby.pp @@ -1,4 +1,8 @@ -# Private class +# @summary +# Private class for installing ruby language bindings +# +# @api private +# class mysql::bindings::ruby { package{ 'ruby_mysql': diff --git a/manifests/client.pp b/manifests/client.pp index 2af2351d3..58cd04f71 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,3 +1,23 @@ +# @summary +# Installs and configures the MySQL client. +# +# @example Install the MySQL client +# class {'::mysql::client': +# package_name => 'mysql-client', +# package_ensure => 'present', +# bindings_enable => true, +# } +# +# @param bindings_enable +# Whether to automatically install all bindings. Valid values are `true`, `false`. Default to `false`. +# @param install_options +# Array of install options for managed package resources. You must pass the appropriate options for the package manager. +# @param package_ensure +# Whether the MySQL package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. +# @param package_manage +# Whether to manage the MySQL client package. Defaults to `true`. +# @param package_name +# The name of the MySQL client package to install. # class mysql::client ( $bindings_enable = $mysql::params::bindings_enable, diff --git a/manifests/client/install.pp b/manifests/client/install.pp index 26e5ec276..9e5f98e7c 100644 --- a/manifests/client/install.pp +++ b/manifests/client/install.pp @@ -1,4 +1,8 @@ -# See README.md. +# @summary +# Private class for MySQL client install. +# +# @api private +# class mysql::client::install { if $mysql::client::package_manage { diff --git a/manifests/db.pp b/manifests/db.pp index 6b6c39b9b..d36f8852d 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -1,4 +1,39 @@ -# See README.md for details. +# @summary +# Create and configure a MySQL database. +# +# @example Create a database +# mysql::db { 'mydb': +# user => 'myuser', +# password => 'mypass', +# host => 'localhost', +# grant => ['SELECT', 'UPDATE'], +# } +# +# @param user +# The user for the database you're creating. +# @param password +# The password for $user for the database you're creating. +# @param dbname +# The name of the database to create. +# @param charset +# The character set for the database. +# @param collate +# The collation for the database. +# @param host +# The host to use as part of user@host for grants. +# @param grant +# The privileges to be granted for user@host on the database. +# @param sql +# 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. +# @param enforce_sql +# Specifies whether executing the sqlfiles should happen on every run. If set to false, sqlfiles only run once. +# @param ensure +# Specifies whether to create the database. Valid values are 'present', 'absent'. Defaults to 'present'. +# @param import_timeout +# Timeout, in seconds, for loading the sqlfiles. Defaults to 300. +# @param import_cat_cmd +# Command to read the sqlfile for importing the database. Useful for compressed sqlfiles. For example, you can use 'zcat' for .gz files. +# define mysql::db ( $user, $password, diff --git a/manifests/params.pp b/manifests/params.pp index 877bae1a7..e28fa0071 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,4 +1,8 @@ -# Private class: See README.md. +# @summary +# Params class. +# +# @api private +# class mysql::params { $manage_config_file = true diff --git a/manifests/server.pp b/manifests/server.pp index 11e074880..e5f216af1 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -1,4 +1,69 @@ -# Class: mysql::server: See README.md for documentation. +# @summary +# Installs and configures the MySQL server. +# +# @example Install MySQL Server +# class { '::mysql::server': +# package_name => 'mysql-server', +# package_ensure => '5.7.1+mysql~trusty', +# root_password => 'strongpassword', +# remove_default_accounts => true, +# } +# +# @param config_file +# The location, as a path, of the MySQL configuration file. +# @param includedir +# The location, as a path, of !includedir for custom configuration overrides. +# @param install_options +# 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 +# @param install_secret_file +# Path to secret file containing temporary root password. +# @param manage_config_file +# Whether the MySQL configuration file should be managed. Valid values are `true`, `false`. Defaults to `true`. +# @param override_options +# Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: See above for usage details. +# @param package_ensure +# Whether the package exists or should be a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Defaults to 'present'. +# @param package_manage +# Whether to manage the MySQL server package. Defaults to `true`. +# @param package_name +# The name of the MySQL server package to install. +# @param purge_conf_dir +# Whether the `includedir` directory should be purged. Valid values are `true`, `false`. Defaults to `false`. +# @param remove_default_accounts +# Specifies whether to automatically include `mysql::server::account_security`. Valid values are `true`, `false`. Defaults to `false`. +# @param restart +# Whether the service should be restarted when things change. Valid values are `true`, `false`. Defaults to `false`. +# @param root_group +# 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). +# @param mysql_group +# 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). +# @param root_password +# 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. +# @param service_enabled +# Specifies whether the service should be enabled. Valid values are `true`, `false`. Defaults to `true`. +# @param service_manage +# Specifies whether the service should be managed. Valid values are `true`, `false`. Defaults to `true`. +# @param service_name +# The name of the MySQL server service. Defaults are OS dependent, defined in 'params.pp'. +# @param service_provider +# The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined. +# @param create_root_user +# 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. +# @param create_root_my_cnf +# 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. +# @param users +# Optional hash of users to create, which are passed to [mysql_user](#mysql_user). +# @param grants +# Optional hash of grants, which are passed to [mysql_grant](#mysql_grant). +# @param databases +# Optional hash of databases to create, which are passed to [mysql_database](#mysql_database). +# @param enabled +# _Deprecated_ +# @param manage_service +# _Deprecated_ +# @param old_root_password +# 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. +# class mysql::server ( $config_file = $mysql::params::config_file, $includedir = $mysql::params::includedir, diff --git a/manifests/server/account_security.pp b/manifests/server/account_security.pp index 3fcdd614c..c2095d83a 100644 --- a/manifests/server/account_security.pp +++ b/manifests/server/account_security.pp @@ -1,4 +1,8 @@ -# See README.md. +# @summary +# Private class for ensuring localhost accounts do not exist +# +# @api private +# class mysql::server::account_security { mysql_user { [ 'root@127.0.0.1', diff --git a/manifests/server/backup.pp b/manifests/server/backup.pp index 21102d384..8c69d42ab 100644 --- a/manifests/server/backup.pp +++ b/manifests/server/backup.pp @@ -1,4 +1,60 @@ -# See README.me for usage. +# @summary +# Create and manage a MySQL backup. +# +# @example Create a basic MySQL backup: +# class { 'mysql::server': +# root_password => 'password' +# } +# class { 'mysql::server::backup': +# backupuser => 'myuser', +# backuppassword => 'mypassword', +# backupdir => '/tmp/backups', +# } +# +# @param backupuser +# MySQL user with backup administrator privileges. +# @param backuppassword +# Password for `backupuser`. +# @param backupdir +# Directory to store backup. +# @param backupdirmode +# Permissions applied to the backup directory. This parameter is passed directly to the file resource. +# @param backupdirowner +# Owner for the backup directory. This parameter is passed directly to the file resource. +# @param backupdirgroup +# Group owner for the backup directory. This parameter is passed directly to the file resource. +# @param backupcompress +# Whether or not to compress the backup (when using the mysqldump provider) +# @param backuprotate +# Backup rotation interval in 24 hour periods. +# @param ignore_events +# Ignore the mysql.event table. +# @param delete_before_dump +# 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. +# @param backupdatabases +# Databases to backup (if using xtrabackup provider). +# @param file_per_database +# Use file per database mode creating one file per database backup. +# @param include_routines +# Dump stored routines (procedures and functions) from dumped databases when doing a `file_per_database` backup. +# @param include_triggers +# Dump triggers for each dumped table when doing a `file_per_database` backup. +# @param ensure +# @param time +# 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. +# @param prescript +# A script that is executed before the backup begins. +# @param postscript +# 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. +# @param execpath +# Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. +# @param provider +# Sets the server backup implementation. Valid values are: +# @param maxallowedpacket +# Defines the maximum SQL statement size for the backup dump script. The default value is 1MB, as this is the default MySQL Server value. +# @param optional_args +# Specifies an array of optional arguments which should be passed through to the backup tool. (Currently only supported by the xtrabackup provider.) +# class mysql::server::backup ( $backupuser = undef, $backuppassword = undef, diff --git a/manifests/server/binarylog.pp b/manifests/server/binarylog.pp index 459915d0c..ddd52896b 100644 --- a/manifests/server/binarylog.pp +++ b/manifests/server/binarylog.pp @@ -1,4 +1,8 @@ -# Binary log configuration requires the mysql user to be present. This must be done after package install +# @summary +# Binary log configuration requires the mysql user to be present. This must be done after package install +# +# @api private +# class mysql::server::binarylog { $options = $mysql::server::options diff --git a/manifests/server/config.pp b/manifests/server/config.pp index de97bea5e..d31b274d6 100644 --- a/manifests/server/config.pp +++ b/manifests/server/config.pp @@ -1,4 +1,8 @@ -# See README.me for options. +# @summary +# Private class for MySQL server configuration. +# +# @api private +# class mysql::server::config { $options = $mysql::server::options diff --git a/manifests/server/install.pp b/manifests/server/install.pp index 3b9601def..21c762ef7 100644 --- a/manifests/server/install.pp +++ b/manifests/server/install.pp @@ -1,3 +1,7 @@ +# @summary +# Private class for managing MySQL package. +# +# @api private # class mysql::server::install { diff --git a/manifests/server/installdb.pp b/manifests/server/installdb.pp index 7e5423328..ee80b4604 100644 --- a/manifests/server/installdb.pp +++ b/manifests/server/installdb.pp @@ -1,3 +1,7 @@ +# @summary +# Builds initial databases on installation. +# +# @api private # class mysql::server::installdb { $options = $mysql::server::options diff --git a/manifests/server/monitor.pp b/manifests/server/monitor.pp index 6b1860983..f823671a9 100644 --- a/manifests/server/monitor.pp +++ b/manifests/server/monitor.pp @@ -1,4 +1,13 @@ -#This is a helper class to add a monitoring user to the database +# @summary +# This is a helper class to add a monitoring user to the database +# +# @param mysql_monitor_username +# The username to create for MySQL monitoring. +# @param mysql_monitor_password +# The password to create for MySQL monitoring. +# @param mysql_monitor_hostname +# The hostname from which the monitoring user requests are allowed access. +# class mysql::server::monitor ( $mysql_monitor_username = '', $mysql_monitor_password = '', diff --git a/manifests/server/mysqltuner.pp b/manifests/server/mysqltuner.pp index ae91e63ac..b337f50ca 100644 --- a/manifests/server/mysqltuner.pp +++ b/manifests/server/mysqltuner.pp @@ -1,3 +1,14 @@ +# @summary +# Manage the MySQLTuner package. +# +# @param ensure +# Ensures that the resource exists. Valid values are 'present', 'absent'. Defaults to 'present'. +# @param version +# The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. Defaults to 'v1.3.0'. +# @param source +# Source path for the mysqltuner package. +# @param environment +# Environment variables active during download, e.g. to download via proxies: environment => 'https_proxy=http://proxy.example.com:80' # class mysql::server::mysqltuner( $ensure = 'present', diff --git a/manifests/server/providers.pp b/manifests/server/providers.pp index b651172fc..89b761d19 100644 --- a/manifests/server/providers.pp +++ b/manifests/server/providers.pp @@ -1,6 +1,9 @@ -# Convenience class to call each of the three providers with the corresponding -# hashes provided in mysql::server. -# See README.md for details. +# @summary +# Convenience class to call each of the three providers with the corresponding +# hashes provided in mysql::server. +# +# @api private +# class mysql::server::providers { create_resources('mysql_user', $mysql::server::users) create_resources('mysql_grant', $mysql::server::grants) diff --git a/manifests/server/root_password.pp b/manifests/server/root_password.pp index 9ebc10398..0a5a79ffd 100644 --- a/manifests/server/root_password.pp +++ b/manifests/server/root_password.pp @@ -1,3 +1,7 @@ +# @summary +# Private class for managing the root password +# +# @api private # class mysql::server::root_password { diff --git a/manifests/server/service.pp b/manifests/server/service.pp index 3ce81d483..f9bc20c2a 100644 --- a/manifests/server/service.pp +++ b/manifests/server/service.pp @@ -1,3 +1,7 @@ +# @summary +# Private class for managing the MySQL service +# +# @api private # class mysql::server::service { $options = $mysql::server::options From c7815758d2ae213828bb6d6100e3a6c2d045a31f Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 4 May 2018 14:56:50 -0700 Subject: [PATCH 2/2] Rubocop for docs --- lib/puppet/parser/functions/mysql_deepmerge.rb | 2 +- lib/puppet/parser/functions/mysql_dirname.rb | 2 +- lib/puppet/parser/functions/mysql_password.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/puppet/parser/functions/mysql_deepmerge.rb b/lib/puppet/parser/functions/mysql_deepmerge.rb index 766028e89..87db63c53 100644 --- a/lib/puppet/parser/functions/mysql_deepmerge.rb +++ b/lib/puppet/parser/functions/mysql_deepmerge.rb @@ -1,4 +1,4 @@ -module Puppet::Parser::Functions +module Puppet::Parser::Functions # rubocop:disable Style/Documentation newfunction(:mysql_deepmerge, type: :rvalue, doc: <<-'ENDHEREDOC') do |args| @summary Recursively merges two or more hashes together and returns the resulting hash. diff --git a/lib/puppet/parser/functions/mysql_dirname.rb b/lib/puppet/parser/functions/mysql_dirname.rb index 40a8ad64f..272d29464 100644 --- a/lib/puppet/parser/functions/mysql_dirname.rb +++ b/lib/puppet/parser/functions/mysql_dirname.rb @@ -1,4 +1,4 @@ -module Puppet::Parser::Functions +module Puppet::Parser::Functions # rubocop:disable Style/Documentation newfunction(:mysql_dirname, type: :rvalue, doc: <<-EOS @summary Returns the dirname of a path diff --git a/lib/puppet/parser/functions/mysql_password.rb b/lib/puppet/parser/functions/mysql_password.rb index 53ba580b2..d896a3e1f 100644 --- a/lib/puppet/parser/functions/mysql_password.rb +++ b/lib/puppet/parser/functions/mysql_password.rb @@ -1,5 +1,5 @@ require 'digest/sha1' -module Puppet::Parser::Functions +module Puppet::Parser::Functions # rubocop:disable Style/Documentation newfunction(:mysql_password, type: :rvalue, doc: <<-EOS @summary Hash a string as mysql's "PASSWORD()" function would do it