Merge pull request #750 from puppetlabs/3.6.x

Mergeback 3.6.x
This commit is contained in:
Morgan Haskel 2015-08-12 14:33:30 -07:00
commit 7681c1363a
3 changed files with 131 additions and 123 deletions

View file

@ -1,3 +1,17 @@
## 2015-08-10 - Supported Release 3.6.0
### Summary
This release adds the ability to use mysql::db and `mysql_*` types against unmanaged or external mysql instances.
#### Features
- Add ability to use mysql::db WITHOUT mysql::server (ie, externally)
- Add prescript attribute to mysql::server::backup for xtrabackup
- Add postscript ability to xtrabackup provider.
#### Bugfixes
- Fix default root passwords blocking puppet on mysql 5.8
- Fix service dependency when package_manage is false
- Fix selinux permissions on my.cnf
##2015-07-23 - Supported Release 3.5.0
###Summary
A small release to add explicit support to newer Puppet versions and accumulated patches.

238
README.md
View file

@ -1,10 +1,9 @@
#MySQL
# mysql
####Table of Contents
#### Table of Contents
1. [Overview](#overview)
2. [Module Description - What the module does and why it is useful](#module-description)
3. [Backwards compatibility information](#backwards-compatibility)
1. [Module Description - What the module does and why it is useful](#module-description)
2. [Backwards compatibility information](#backwards-compatibility)
3. [Setup - The basics of getting started with mysql](#setup)
* [Beginning with mysql](#beginning-with-mysql)
4. [Usage - Configuration options and additional functionality](#usage)
@ -12,26 +11,18 @@
* [Creating a Database](#creating-a-database)
* [Custom Configuration](#custom-configuration)
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
5. [Limitations - OS compatibility, etc.](#limitations)
6. [Development - Guide for contributing to the module](#development)
6. [Limitations - OS compatibility, etc.](#limitations)
7. [Development - Guide for contributing to the module](#development)
##Overview
## Module Description
The MySQL module installs, configures, and manages the MySQL service.
##Module Description
The MySQL module manages both the installation and configuration of MySQL, as well as extending Puppet to allow management of MySQL resources, such as databases, users, and grants.
##Setup
## Setup
###What MySQL affects
* MySQL package
* MySQL configuration files
* MySQL service
###Beginning with MySQL
### Beginning with MySQL
If you want a server installed with the default options you can run
`include '::mysql::server'`.
@ -49,11 +40,11 @@ class { '::mysql::server':
See [**Customizing Server Options**](#customizing-server-options) below for examples of the hash structure for $override_options`.
##Usage
## Usage
All interaction for the server is done via `mysql::server`. To install the client, use `mysql::client`. To install bindings, use `mysql::bindings`.
###Customizing Server Options
### Customizing Server Options
The hash structure for overrides in `mysql::server` can be structured like a hash in the my.cnf file, so:
@ -141,40 +132,41 @@ mysql::db { 'mydb':
}
~~~
###Custom Configuration
### Custom Configuration
To add custom MySQL configuration, drop additional files into
`includedir`. Dropping files into `includedir` allows you to override settings or add additional ones, which is helpful if you choose not to use `override_options` in `mysql::server`. The `includedir` location is by default set to /etc/mysql/conf.d.
###Working with an existing server
### Working with an existing server
It is possible to use the MySQL module to instantiate databases and
users on an existing MySQL server. For this to work, you will need an
You can use the MySQL module to instantiate databases and
users on an existing MySQL server. For this to work, you need an
appropriate `.my.cnf` in `root`'s home directory containing the remote
server address and credentials. For example:
server address and credentials. For example:
[client]
user=root
host=localhost
password=secret
When working with a remote server, you will *not* use the
When working with a remote server, do *not* use the
`mysql::server` class in your Puppet manifests.
##Reference
## Reference
###Classes
### Classes
####Public classes
* `mysql::server`: Installs and configures MySQL.
* `mysql::server::account_security`: Deletes default MySQL accounts.
* `mysql::server::monitor`: Sets up a monitoring user.
* `mysql::server::mysqltuner`: Installs MySQL tuner script.
* `mysql::server::backup`: Sets up MySQL backups via cron.
* `mysql::bindings`: Installs various MySQL language bindings.
* `mysql::client`: Installs MySQL client (for non-servers).
#### 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
####Private classes
* `mysql::server::install`: Installs packages.
* `mysql::server::config`: Configures MYSQL.
* `mysql::server::service`: Manages service.
@ -193,11 +185,11 @@ When working with a remote server, you will *not* use the
* `mysql::backup::mysqlbackup`: Implements backups with Oracle MySQL Enterprise Backup.
* `mysql::backup::xtrabackup`: Implements backups with XtraBackup from Percona.
###Parameters
### Parameters
####mysql::server
#### mysql::server
#####`create_root_user`
##### `create_root_user`
Specify whether root user should be created. Valid values are 'true', 'false'. Defaults to 'true'.
@ -205,13 +197,13 @@ This is useful for a cluster setup with Galera. The root user has to
be created only once. `create_root_user` can be set to 'true' on one node while
it is set to 'false' on the remaining nodes.
#####`create_root_my_cnf`
##### `create_root_my_cnf`
If set to 'true', creates `/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`. This can be used for a cluster setup with Galera where you want `/root/.my.cnf` to exist on all nodes.
#####`root_password`
##### `root_password`
The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it.
@ -219,11 +211,11 @@ This is required if `create_root_user` or `create_root_my_cnf` are 'true'. If `r
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`
##### `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`
##### `override_options`
The hash of override options to pass into MySQL. Structured like a hash in the my.cnf file:
@ -237,69 +229,69 @@ $override_options = {
See [**Customizing Server Options**](#customizing-server-options) above for usage details.
#####`config_file`
##### `config_file`
The location, as a path, of the MySQL configuration file.
#####`manage_config_file`
##### `manage_config_file`
Whether the MySQL configuration file should be managed. Valid values are 'true', 'false'. Defaults to 'true'.
#####`includedir`
##### `includedir`
The location, as a path, of !includedir for custom configuration overrides.
#####`install_options`
##### `install_options`
Pass [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`
##### `purge_conf_dir`
Whether the `includedir` directory should be purged. Valid values are 'true', 'false'. Defaults to 'false'.
#####`restart`
##### `restart`
Whether the service should be restarted when things change. Valid values are 'true', 'false'. Defaults to 'false'.
#####`root_group`
##### `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`
##### `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`
##### `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`
##### `package_manage`
Whether to manage the MySQL server package. Defaults to true.
#####`package_name`
##### `package_name`
The name of the MySQL server package to install.
#####`remove_default_accounts`
##### `remove_default_accounts`
Specify whether to automatically include `mysql::server::account_security`. Valid values are 'true', 'false'. Defaults to 'false'.
#####`service_enabled`
##### `service_enabled`
Specify whether the service should be enabled. Valid values are 'true', 'false'. Defaults to 'true'.
#####`service_manage`
##### `service_manage`
Specify whether the service should be managed. Valid values are 'true', 'false'. Defaults to 'true'.
#####`service_name`
##### `service_name`
The name of the MySQL server service. Defaults are OS dependent, defined in params.pp.
#####`service_provider`
##### `service_provider`
The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined.
#####`users`
##### `users`
Optional hash of users to create, which are passed to [mysql_user](#mysql_user).
@ -316,7 +308,7 @@ users => {
}
~~~
#####`grants`
##### `grants`
Optional hash of grants, which are passed to [mysql_grant](#mysql_grant).
@ -332,7 +324,7 @@ grants => {
}
~~~
#####`databases`
##### `databases`
Optional hash of databases to create, which are passed to [mysql_database](#mysql_database).
@ -345,80 +337,84 @@ databases => {
}
~~~
####mysql::server::backup
#### mysql::server::backup
#####`backupuser`
##### `backupuser`
MySQL user to create for backups.
#####`backuppassword`
##### `backuppassword`
MySQL user password for backups.
#####`backupdir`
##### `backupdir`
Directory in which to store backups.
#####`backupdirmode`
##### `backupdirmode`
Permissions applied to the backup directory. This parameter is passed directly
to the `file` resource.
#####`backupdirowner`
##### `backupdirowner`
Owner for the backup directory. This parameter is passed directly to the `file`
resource.
#####`backupdirgroup`
##### `backupdirgroup`
Group owner for the backup directory. This parameter is passed directly to the
`file` resource.
#####`backupcompress`
##### `backupcompress`
Whether backups should be compressed. Valid values are 'true', 'false'. Defaults to 'true'.
#####`backuprotate`
##### `backuprotate`
How many days to keep backups. Valid value is an integer. Defaults to '30'.
#####`delete_before_dump`
##### `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`
##### `backupdatabases`
Specify an array of databases to back up.
#####`file_per_database`
##### `file_per_database`
Whether a separate file be used per database. Valid values are 'true', 'false'. Defaults to 'false'.
#####`include_routines`
##### `include_routines`
Whether or not to include routines for each database when doing a `file_per_database` backup. Defaults to `false`.
#####`include_triggers`
##### `include_triggers`
Whether or not to include triggers for each database when doing a `file_per_database` backup. Defaults to `false`.
#####`ensure`
##### `ensure`
Allows you to remove the backup scripts. Valid values are 'present', 'absent'. Defaults to 'present'.
#####`execpath`
##### `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`
##### `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.
#####`postscript`
##### `postscript`
A script that is executed at when the backup is finished. This could be used to (r)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.
A script that is executed when the backup is finished. This could be used to (r)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.
#####`provider`
##### `prescript`
A script that is executed before the backup begins.
##### `provider`
Sets the server backup implementation. Valid values are:
@ -426,21 +422,21 @@ Sets the server backup implementation. Valid values are:
* `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.
####mysql::server::monitor
#### mysql::server::monitor
#####`mysql_monitor_username`
##### `mysql_monitor_username`
The username to create for MySQL monitoring.
#####`mysql_monitor_password`
##### `mysql_monitor_password`
The password to create for MySQL monitoring.
#####`mysql_monitor_hostname`
##### `mysql_monitor_hostname`
The hostname from which the monitoring user requests are allowed access.
####mysql::server::mysqltuner
#### 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.
@ -456,7 +452,7 @@ The version to install from the major/MySQLTuner-perl github repository. Must be
Parameter to optionally specify the source. If not specified, defaults to `https://github.com/major/MySQLTuner-perl/raw/${version}/mysqltuner.pl`
####mysql::bindings
#### mysql::bindings
##### `client_dev`
@ -470,7 +466,7 @@ Specify whether `::mysql::bindings::daemon_dev` should be included. Valid values
Specify whether `::mysql::bindings::java` should be included. Valid values are 'true', 'false'. Defaults to 'false'.
##### `perl_enable`
##### `perl_enable`
Specify whether `mysql::bindings::perl` should be included. Valid values are 'true', 'false'. Defaults to 'false'.
@ -514,27 +510,27 @@ The name of the daemon_dev package to install. Only applies if `daemon_dev => tr
The provider to use to install the daemon_dev package. Only applies if `daemon_dev => true`.
#####`java_package_ensure`
##### `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`
##### `java_package_name`
The name of the Java package to install. Only applies if `java_enable => true`.
#####`java_package_provider`
##### `java_package_provider`
The provider to use to install the Java package. Only applies if `java_enable => true`.
#####`perl_package_ensure`
##### `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`
##### `perl_package_name`
The name of the Perl package to install. Only applies if `perl_enable => true`.
#####`perl_package_provider`
##### `perl_package_provider`
The provider to use to install the Perl package. Only applies if `perl_enable => true`.
@ -546,54 +542,54 @@ Whether the package should be present, absent, or a specific version. Valid valu
The name of the PHP package to install. Only applies if `php_enable => true`.
#####`python_package_ensure`
##### `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`
##### `python_package_name`
The name of the Python package to install. Only applies if `python_enable => true`.
#####`python_package_provider`
##### `python_package_provider`
The provider to use to install the PHP package. Only applies if `python_enable => true`.
#####`ruby_package_ensure`
##### `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`
##### `ruby_package_name`
The name of the Ruby package to install. Only applies if `ruby_enable => true`.
#####`ruby_package_provider`
##### `ruby_package_provider`
What provider should be used to install the package.
####mysql::client
#### mysql::client
#####`bindings_enable`
##### `bindings_enable`
Whether to automatically install all bindings. Valid values are 'true', 'false'. Default to 'false'.
#####`install_options`
##### `install_options`
Array of install options for managed package resources. You must pass the appropriate options for the package manager.
#####`package_ensure`
##### `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`
##### `package_manage`
Whether to manage the MySQL client package. Defaults to true.
#####`package_name`
##### `package_name`
The name of the MySQL client package to install.
###Defined Types
### Defines
####mysql::db
#### mysql::db
~~~
mysql_database { 'information_schema':
@ -652,10 +648,9 @@ Specify whether to create the database. Valid values are 'present', 'absent'. De
Timeout, in seconds, for loading the sqlfiles. Defaults to '300'.
### Types
###Types
####mysql_database
#### mysql_database
`mysql_database` creates and manages databases within MySQL.
@ -675,7 +670,7 @@ The CHARACTER SET setting for the database. Defaults to ':utf8'.
The COLLATE setting for the database. Defaults to ':utf8_general_ci'.
####mysql_user
#### mysql_user
Creates and manages user grants within MySQL.
@ -723,10 +718,10 @@ Maximum queries per hour for the user. Must be an integer value. A value of '0'
Maximum updates per hour for the user. Must be an integer value. A value of '0' specifies no (or global) limit.
####mysql_grant
#### mysql_grant
`mysql_grant` creates grant permissions to access databases within
MySQL. To use it you must create the title of the resource as shown below,
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`:
~~~
@ -774,7 +769,7 @@ User to whom privileges are granted.
MySQL options to grant. Optional.
####mysql_plugin
#### mysql_plugin
`mysql_plugin` can be used to load plugins into the MySQL Server.
@ -793,11 +788,11 @@ Whether the resource is present. Valid values are 'present', 'absent'. Defaults
The name of the MySQL plugin to manage.
##### `soname`
##### `soname`
The library file name.
###Facts
### Facts
#### `mysql_version`
@ -809,7 +804,7 @@ 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.
##Limitations
## Limitations
This module has been tested on:
@ -819,11 +814,10 @@ This module has been tested on:
* Ubuntu 10.04, 12.04, 14.04
* Scientific Linux 5, 6
* SLES 11
* Solaris 11.2, 11.3, 12.0
Testing on other platforms has been minimal and cannot be guaranteed.
#Development
## Development
Puppet Labs modules on the Puppet Forge are open projects, and community
contributions are essential for keeping them great. We can't access the

View file

@ -1,6 +1,6 @@
{
"name": "puppetlabs-mysql",
"version": "3.5.0",
"version": "3.6.0",
"author": "Puppet Labs",
"summary": "Installs, configures, and manages the MySQL service.",
"license": "Apache-2.0",