author | ymh <ymh.work@gmail.com> |
Mon, 19 Dec 2016 21:58:29 +0100 | |
changeset 478 | b621657bb436 |
parent 146 | dc4d1cdc47e0 |
permissions | -rw-r--r-- |
28 | 1 |
# mysql |
2 |
||
3 |
#### Table of Contents |
|
4 |
||
5 |
1. [Module Description - What the module does and why it is useful](#module-description) |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
6 |
2. [Setup - The basics of getting started with mysql](#setup) |
28 | 7 |
* [Beginning with mysql](#beginning-with-mysql) |
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
8 |
3. [Usage - Configuration options and additional functionality](#usage) |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
9 |
* [Customize server options](#customize-server-options) |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
10 |
* [Create a database](#create-a-database) |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
11 |
* [Customize configuration](#create-custom-configuration) |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
12 |
* [Work with an existing server](#work-with-an-existing-server) |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
13 |
* [Specify passwords](#specify-passwords) |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
14 |
4. [Reference - An under-the-hood peek at what the module is doing and how](#reference) |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
15 |
5. [Limitations - OS compatibility, etc.](#limitations) |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
16 |
6. [Development - Guide for contributing to the module](#development) |
28 | 17 |
|
18 |
## Module Description |
|
19 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
20 |
The mysql module installs, configures, and manages the MySQL service. |
28 | 21 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
22 |
This 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. |
28 | 23 |
|
24 |
## Setup |
|
25 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
26 |
### Beginning with mysql |
28 | 27 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
28 |
To install a server with the default options: |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
29 |
|
28 | 30 |
`include '::mysql::server'`. |
31 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
32 |
To customize options, such as the root |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
33 |
password or `/etc/my.cnf` settings, you must also pass in an override hash: |
28 | 34 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
35 |
```puppet |
28 | 36 |
class { '::mysql::server': |
37 |
root_password => 'strongpassword', |
|
38 |
remove_default_accounts => true, |
|
39 |
override_options => $override_options |
|
40 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
41 |
``` |
28 | 42 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
43 |
See [**Customize Server Options**](#customize-server-options) below for examples of the hash structure for $override_options`. |
28 | 44 |
|
45 |
## Usage |
|
46 |
||
47 |
All interaction for the server is done via `mysql::server`. To install the client, use `mysql::client`. To install bindings, use `mysql::bindings`. |
|
48 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
49 |
### Customize server options |
28 | 50 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
51 |
To define server options, structure a hash structure of overrides in `mysql::server`. This hash resembles a hash in the my.cnf file: |
28 | 52 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
53 |
```puppet |
28 | 54 |
$override_options = { |
55 |
'section' => { |
|
56 |
'item' => 'thing', |
|
57 |
} |
|
58 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
59 |
``` |
28 | 60 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
61 |
For options that you would traditionally represent in this format: |
28 | 62 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
63 |
``` |
28 | 64 |
[section] |
65 |
thing = X |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
66 |
``` |
28 | 67 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
68 |
...you can make an entry like `thing => true`, `thing => value`, or `thing => "` in the hash. Alternatively, you can pass an array, as `thing => ['value', 'value2']`, or list each `thing => value` separately on separate lines. |
28 | 69 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
70 |
You can pass a variable in the hash without setting a value for it; the variable would then use MySQL's default settings. To exclude an option from the my.cnf file --- for example, when using `override_options` to revert to a default value --- pass `thing => undef`. |
28 | 71 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
72 |
If an option needs multiple instances, pass an array. For example, |
28 | 73 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
74 |
```puppet |
28 | 75 |
$override_options = { |
76 |
'mysqld' => { |
|
77 |
'replicate-do-db' => ['base1', 'base2'], |
|
78 |
} |
|
79 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
80 |
``` |
28 | 81 |
|
82 |
produces |
|
83 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
84 |
``` |
28 | 85 |
[mysqld] |
86 |
replicate-do-db = base1 |
|
87 |
replicate-do-db = base2 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
88 |
``` |
28 | 89 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
90 |
To implement version specific parameters, specify the version, such as [mysqld-5.5]. This allows one config for different versions of MySQL. |
28 | 91 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
92 |
### Create a database |
28 | 93 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
94 |
To create a database with a user and some assigned privileges: |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
95 |
|
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
96 |
```puppet |
28 | 97 |
mysql::db { 'mydb': |
98 |
user => 'myuser', |
|
99 |
password => 'mypass', |
|
100 |
host => 'localhost', |
|
101 |
grant => ['SELECT', 'UPDATE'], |
|
102 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
103 |
``` |
28 | 104 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
105 |
To use a different resource name with exported resources: |
28 | 106 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
107 |
```puppet |
28 | 108 |
@@mysql::db { "mydb_${fqdn}": |
109 |
user => 'myuser', |
|
110 |
password => 'mypass', |
|
111 |
dbname => 'mydb', |
|
112 |
host => ${fqdn}, |
|
113 |
grant => ['SELECT', 'UPDATE'], |
|
114 |
tag => $domain, |
|
115 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
116 |
``` |
28 | 117 |
|
118 |
Then you can collect it on the remote DB server: |
|
119 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
120 |
```puppet |
28 | 121 |
Mysql::Db <<| tag == $domain |>> |
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
122 |
``` |
28 | 123 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
124 |
If you set the sql parameter to a file when creating a database, the file is imported into the new database. |
28 | 125 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
126 |
For large sql files, increase the `import_timeout` parameter, which defaults to 300 seconds. |
28 | 127 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
128 |
```puppet |
28 | 129 |
mysql::db { 'mydb': |
130 |
user => 'myuser', |
|
131 |
password => 'mypass', |
|
132 |
host => 'localhost', |
|
133 |
grant => ['SELECT', 'UPDATE'], |
|
134 |
sql => '/path/to/sqlfile', |
|
135 |
import_timeout => 900, |
|
136 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
137 |
``` |
28 | 138 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
139 |
### Customize configuration |
28 | 140 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
141 |
To add custom MySQL configuration, place additional files into `includedir`. This allows you to override settings or add additional ones, which is helpful if you don't use `override_options` in `mysql::server`. The `includedir` location is by default set to `/etc/mysql/conf.d`. |
28 | 142 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
143 |
### Work with an existing server |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
144 |
|
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
145 |
To instantiate databases and users on an existing MySQL server, you need a `.my.cnf` file in `root`'s home directory. This file must specify the remote server address and credentials. For example: |
28 | 146 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
147 |
``` |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
148 |
[client] |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
149 |
user=root |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
150 |
host=localhost |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
151 |
password=secret |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
152 |
``` |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
153 |
|
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
154 |
When working with a remote server, do *not* use the `mysql::server` class in your Puppet manifests. |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
155 |
|
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
156 |
### Specify passwords |
28 | 157 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
158 |
In addition to passing passwords as plain text, you can input them as hashes. For example: |
28 | 159 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
160 |
```puppet |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
161 |
mysql::db { 'mydb': |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
162 |
user => 'myuser', |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
163 |
password => '*6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4', |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
164 |
host => 'localhost', |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
165 |
grant => ['SELECT', 'UPDATE'], |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
166 |
} |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
167 |
``` |
28 | 168 |
|
169 |
## Reference |
|
170 |
||
171 |
### Classes |
|
172 |
||
173 |
#### Public classes |
|
174 |
||
175 |
* [`mysql::server`](#mysqlserver): Installs and configures MySQL. |
|
176 |
* [`mysql::server::monitor`](#mysqlservermonitor): Sets up a monitoring user. |
|
177 |
* [`mysql::server::mysqltuner`](#mysqlservermysqltuner): Installs MySQL tuner script. |
|
178 |
* [`mysql::server::backup`](#mysqlserverbackup): Sets up MySQL backups via cron. |
|
179 |
* [`mysql::bindings`](#mysqlbindings): Installs various MySQL language bindings. |
|
180 |
* [`mysql::client`](#mysqlclient): Installs MySQL client (for non-servers). |
|
181 |
||
182 |
#### Private classes |
|
183 |
||
184 |
* `mysql::server::install`: Installs packages. |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
185 |
* `mysql::server::installdb`: Implements setup of mysqld data directory (e.g. /var/lib/mysql) |
28 | 186 |
* `mysql::server::config`: Configures MYSQL. |
187 |
* `mysql::server::service`: Manages service. |
|
188 |
* `mysql::server::account_security`: Deletes default MySQL accounts. |
|
189 |
* `mysql::server::root_password`: Sets MySQL root password. |
|
190 |
* `mysql::server::providers`: Creates users, grants, and databases. |
|
191 |
* `mysql::bindings::client_dev`: Installs MySQL client development package. |
|
192 |
* `mysql::bindings::daemon_dev`: Installs MySQL daemon development package. |
|
193 |
* `mysql::bindings::java`: Installs Java bindings. |
|
194 |
* `mysql::bindings::perl`: Installs Perl bindings. |
|
195 |
* `mysql::bindings::php`: Installs PHP bindings. |
|
196 |
* `mysql::bindings::python`: Installs Python bindings. |
|
197 |
* `mysql::bindings::ruby`: Installs Ruby bindings. |
|
198 |
* `mysql::client::install`: Installs MySQL client. |
|
199 |
* `mysql::backup::mysqldump`: Implements mysqldump backups. |
|
200 |
* `mysql::backup::mysqlbackup`: Implements backups with Oracle MySQL Enterprise Backup. |
|
201 |
* `mysql::backup::xtrabackup`: Implements backups with XtraBackup from Percona. |
|
202 |
||
203 |
### Parameters |
|
204 |
||
205 |
#### mysql::server |
|
206 |
||
207 |
##### `create_root_user` |
|
208 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
209 |
Whether root user should be created. Valid values are true, false. Defaults to true. |
28 | 210 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
211 |
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. |
28 | 212 |
|
213 |
##### `create_root_my_cnf` |
|
214 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
215 |
Whether to create `/root/.my.cnf`. Valid values are true, false. Defaults to true. |
28 | 216 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
217 |
`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. |
28 | 218 |
|
219 |
##### `root_password` |
|
220 |
||
221 |
The MySQL root password. Puppet attempts to set the root password and update `/root/.my.cnf` with it. |
|
222 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
223 |
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. |
28 | 224 |
|
225 |
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. |
|
226 |
||
227 |
##### `old_root_password` |
|
228 |
||
229 |
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. |
|
230 |
||
231 |
##### `override_options` |
|
232 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
233 |
Specifies override options to pass into MySQL. Structured like a hash in the my.cnf file: |
28 | 234 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
235 |
```puppet |
28 | 236 |
$override_options = { |
237 |
'section' => { |
|
238 |
'item' => 'thing', |
|
239 |
} |
|
240 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
241 |
``` |
28 | 242 |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
243 |
See [**Customize Server Options**](#customize-server-options) above for usage details. |
28 | 244 |
|
245 |
##### `config_file` |
|
246 |
||
247 |
The location, as a path, of the MySQL configuration file. |
|
248 |
||
249 |
##### `manage_config_file` |
|
250 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
251 |
Whether the MySQL configuration file should be managed. Valid values are true, false. Defaults to true. |
28 | 252 |
|
253 |
##### `includedir` |
|
254 |
The location, as a path, of !includedir for custom configuration overrides. |
|
255 |
||
256 |
##### `install_options` |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
257 |
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. |
28 | 258 |
|
259 |
##### `purge_conf_dir` |
|
260 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
261 |
Whether the `includedir` directory should be purged. Valid values are true, false. Defaults to false. |
28 | 262 |
|
263 |
##### `restart` |
|
264 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
265 |
Whether the service should be restarted when things change. Valid values are true, false. Defaults to false. |
28 | 266 |
|
267 |
##### `root_group` |
|
268 |
||
269 |
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). |
|
270 |
||
271 |
##### `mysql_group` |
|
272 |
||
273 |
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). |
|
274 |
||
275 |
##### `package_ensure` |
|
276 |
||
277 |
Whether the package exists or should be a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Defaults to 'present'. |
|
278 |
||
279 |
##### `package_manage` |
|
280 |
||
281 |
Whether to manage the MySQL server package. Defaults to true. |
|
282 |
||
283 |
##### `package_name` |
|
284 |
||
285 |
The name of the MySQL server package to install. |
|
286 |
||
287 |
##### `remove_default_accounts` |
|
288 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
289 |
Specifies whether to automatically include `mysql::server::account_security`. Valid values are true, false. Defaults to false. |
28 | 290 |
|
291 |
##### `service_enabled` |
|
292 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
293 |
Specifies whether the service should be enabled. Valid values are true, false. Defaults to true. |
28 | 294 |
|
295 |
##### `service_manage` |
|
296 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
297 |
Specifies whether the service should be managed. Valid values are true, false. Defaults to true. |
28 | 298 |
|
299 |
##### `service_name` |
|
300 |
||
301 |
The name of the MySQL server service. Defaults are OS dependent, defined in params.pp. |
|
302 |
||
303 |
##### `service_provider` |
|
304 |
||
305 |
The provider to use to manage the service. For Ubuntu, defaults to 'upstart'; otherwise, default is undefined. |
|
306 |
||
307 |
##### `users` |
|
308 |
||
309 |
Optional hash of users to create, which are passed to [mysql_user](#mysql_user). |
|
310 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
311 |
``` |
28 | 312 |
users => { |
313 |
'someuser@localhost' => { |
|
314 |
ensure => 'present', |
|
315 |
max_connections_per_hour => '0', |
|
316 |
max_queries_per_hour => '0', |
|
317 |
max_updates_per_hour => '0', |
|
318 |
max_user_connections => '0', |
|
319 |
password_hash => '*F3A2A51A9B0F2BE2468926B4132313728C250DBF', |
|
320 |
}, |
|
321 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
322 |
``` |
28 | 323 |
|
324 |
##### `grants` |
|
325 |
||
326 |
Optional hash of grants, which are passed to [mysql_grant](#mysql_grant). |
|
327 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
328 |
``` |
28 | 329 |
grants => { |
330 |
'someuser@localhost/somedb.*' => { |
|
331 |
ensure => 'present', |
|
332 |
options => ['GRANT'], |
|
333 |
privileges => ['SELECT', 'INSERT', 'UPDATE', 'DELETE'], |
|
334 |
table => 'somedb.*', |
|
335 |
user => 'someuser@localhost', |
|
336 |
}, |
|
337 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
338 |
``` |
28 | 339 |
|
340 |
##### `databases` |
|
341 |
||
342 |
Optional hash of databases to create, which are passed to [mysql_database](#mysql_database). |
|
343 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
344 |
``` |
28 | 345 |
databases => { |
346 |
'somedb' => { |
|
347 |
ensure => 'present', |
|
348 |
charset => 'utf8', |
|
349 |
}, |
|
350 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
351 |
``` |
28 | 352 |
|
353 |
#### mysql::server::backup |
|
354 |
||
355 |
##### `backupuser` |
|
356 |
||
357 |
MySQL user to create for backups. |
|
358 |
||
359 |
##### `backuppassword` |
|
360 |
||
361 |
MySQL user password for backups. |
|
362 |
||
363 |
##### `backupdir` |
|
364 |
||
365 |
Directory in which to store backups. |
|
366 |
||
367 |
##### `backupdirmode` |
|
368 |
||
369 |
Permissions applied to the backup directory. This parameter is passed directly |
|
370 |
to the `file` resource. |
|
371 |
||
372 |
##### `backupdirowner` |
|
373 |
||
374 |
Owner for the backup directory. This parameter is passed directly to the `file` |
|
375 |
resource. |
|
376 |
||
377 |
##### `backupdirgroup` |
|
378 |
||
379 |
Group owner for the backup directory. This parameter is passed directly to the |
|
380 |
`file` resource. |
|
381 |
||
382 |
##### `backupcompress` |
|
383 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
384 |
Whether backups should be compressed. Valid values are true, false. Defaults to true. |
28 | 385 |
|
386 |
##### `backuprotate` |
|
387 |
||
388 |
How many days to keep backups. Valid value is an integer. Defaults to '30'. |
|
389 |
||
390 |
##### `delete_before_dump` |
|
391 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
392 |
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. |
28 | 393 |
|
394 |
##### `backupdatabases` |
|
395 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
396 |
Specifies an array of databases to back up. |
28 | 397 |
|
398 |
##### `file_per_database` |
|
399 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
400 |
Whether a separate file be used per database. Valid values are true, false. Defaults to false. |
28 | 401 |
|
402 |
##### `include_routines` |
|
403 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
404 |
Whether or not to include routines for each database when doing a `file_per_database` backup. Defaults to false. |
28 | 405 |
|
406 |
##### `include_triggers` |
|
407 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
408 |
Whether or not to include triggers for each database when doing a `file_per_database` backup. Defaults to false. |
28 | 409 |
|
410 |
##### `ensure` |
|
411 |
||
412 |
Allows you to remove the backup scripts. Valid values are 'present', 'absent'. Defaults to 'present'. |
|
413 |
||
414 |
##### `execpath` |
|
415 |
||
416 |
Allows you to set a custom PATH should your MySQL installation be non-standard places. Defaults to `/usr/bin:/usr/sbin:/bin:/sbin`. |
|
417 |
||
418 |
##### `time` |
|
419 |
||
420 |
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. |
|
421 |
||
422 |
##### `postscript` |
|
423 |
||
424 |
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. |
|
425 |
||
426 |
##### `prescript` |
|
427 |
||
428 |
A script that is executed before the backup begins. |
|
429 |
||
430 |
##### `provider` |
|
431 |
||
432 |
Sets the server backup implementation. Valid values are: |
|
433 |
||
434 |
* `mysqldump`: Implements backups with mysqldump. Backup type: Logical. This is the default value. |
|
435 |
* `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. |
|
436 |
* `xtrabackup`: Implements backups with XtraBackup from Percona. Backup type: Physical. |
|
437 |
||
438 |
#### mysql::server::monitor |
|
439 |
||
440 |
##### `mysql_monitor_username` |
|
441 |
||
442 |
The username to create for MySQL monitoring. |
|
443 |
||
444 |
##### `mysql_monitor_password` |
|
445 |
||
446 |
The password to create for MySQL monitoring. |
|
447 |
||
448 |
##### `mysql_monitor_hostname` |
|
449 |
||
450 |
The hostname from which the monitoring user requests are allowed access. |
|
451 |
||
452 |
#### mysql::server::mysqltuner |
|
453 |
||
454 |
**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. |
|
455 |
||
456 |
##### `ensure` |
|
457 |
||
458 |
Ensures that the resource exists. Valid values are `present`, `absent`. Defaults to `present`. |
|
459 |
||
460 |
##### `version` |
|
461 |
||
462 |
The version to install from the major/MySQLTuner-perl github repository. Must be a valid tag. Defaults to 'v1.3.0'. |
|
463 |
||
464 |
##### `source` |
|
465 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
466 |
Specifies the source. If not specified, defaults to `https://github.com/major/MySQLTuner-perl/raw/${version}/mysqltuner.pl` |
28 | 467 |
|
468 |
#### mysql::bindings |
|
469 |
||
470 |
##### `client_dev` |
|
471 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
472 |
Specifies whether `::mysql::bindings::client_dev` should be included. Valid values are true', false. Defaults to false. |
28 | 473 |
|
474 |
##### `daemon_dev` |
|
475 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
476 |
Specifies whether `::mysql::bindings::daemon_dev` should be included. Valid values are true, false. Defaults to false. |
28 | 477 |
|
478 |
##### `java_enable` |
|
479 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
480 |
Specifies whether `::mysql::bindings::java` should be included. Valid values are true, false. Defaults to false. |
28 | 481 |
|
482 |
##### `perl_enable` |
|
483 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
484 |
Specifies whether `mysql::bindings::perl` should be included. Valid values are true, false. Defaults to false. |
28 | 485 |
|
486 |
##### `php_enable` |
|
487 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
488 |
Specifies whether `mysql::bindings::php` should be included. Valid values are true, false. Defaults to false. |
28 | 489 |
|
490 |
##### `python_enable` |
|
491 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
492 |
Specifies whether `mysql::bindings::python` should be included. Valid values are true, false. Defaults to false. |
28 | 493 |
|
494 |
##### `ruby_enable` |
|
495 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
496 |
Specifies whether `mysql::bindings::ruby` should be included. Valid values are true, false. Defaults to false. |
28 | 497 |
|
498 |
##### `install_options` |
|
499 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
500 |
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). |
28 | 501 |
|
502 |
##### `client_dev_package_ensure` |
|
503 |
||
504 |
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`. |
|
505 |
||
506 |
##### `client_dev_package_name` |
|
507 |
||
508 |
The name of the client_dev package to install. Only applies if `client_dev => true`. |
|
509 |
||
510 |
##### `client_dev_package_provider` |
|
511 |
||
512 |
The provider to use to install the client_dev package. Only applies if `client_dev => true`. |
|
513 |
||
514 |
##### `daemon_dev_package_ensure` |
|
515 |
||
516 |
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`. |
|
517 |
||
518 |
##### `daemon_dev_package_name` |
|
519 |
||
520 |
The name of the daemon_dev package to install. Only applies if `daemon_dev => true`. |
|
521 |
||
522 |
##### `daemon_dev_package_provider` |
|
523 |
||
524 |
The provider to use to install the daemon_dev package. Only applies if `daemon_dev => true`. |
|
525 |
||
526 |
##### `java_package_ensure` |
|
527 |
||
528 |
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`. |
|
529 |
||
530 |
##### `java_package_name` |
|
531 |
||
532 |
The name of the Java package to install. Only applies if `java_enable => true`. |
|
533 |
||
534 |
##### `java_package_provider` |
|
535 |
||
536 |
The provider to use to install the Java package. Only applies if `java_enable => true`. |
|
537 |
||
538 |
##### `perl_package_ensure` |
|
539 |
||
540 |
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`. |
|
541 |
||
542 |
##### `perl_package_name` |
|
543 |
||
544 |
The name of the Perl package to install. Only applies if `perl_enable => true`. |
|
545 |
||
546 |
##### `perl_package_provider` |
|
547 |
||
548 |
The provider to use to install the Perl package. Only applies if `perl_enable => true`. |
|
549 |
||
550 |
##### `php_package_ensure` |
|
551 |
||
552 |
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`. |
|
553 |
||
554 |
##### `php_package_name` |
|
555 |
||
556 |
The name of the PHP package to install. Only applies if `php_enable => true`. |
|
557 |
||
558 |
##### `python_package_ensure` |
|
559 |
||
560 |
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`. |
|
561 |
||
562 |
##### `python_package_name` |
|
563 |
||
564 |
The name of the Python package to install. Only applies if `python_enable => true`. |
|
565 |
||
566 |
##### `python_package_provider` |
|
567 |
||
568 |
The provider to use to install the PHP package. Only applies if `python_enable => true`. |
|
569 |
||
570 |
##### `ruby_package_ensure` |
|
571 |
||
572 |
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`. |
|
573 |
||
574 |
##### `ruby_package_name` |
|
575 |
||
576 |
The name of the Ruby package to install. Only applies if `ruby_enable => true`. |
|
577 |
||
578 |
##### `ruby_package_provider` |
|
579 |
||
580 |
What provider should be used to install the package. |
|
581 |
||
582 |
#### mysql::client |
|
583 |
||
584 |
##### `bindings_enable` |
|
585 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
586 |
Whether to automatically install all bindings. Valid values are true, false. Default to false. |
28 | 587 |
|
588 |
##### `install_options` |
|
589 |
Array of install options for managed package resources. You must pass the appropriate options for the package manager. |
|
590 |
||
591 |
##### `package_ensure` |
|
592 |
||
593 |
Whether the MySQL package should be present, absent, or a specific version. Valid values are 'present', 'absent', or 'x.y.z'. |
|
594 |
||
595 |
##### `package_manage` |
|
596 |
||
597 |
Whether to manage the MySQL client package. Defaults to true. |
|
598 |
||
599 |
##### `package_name` |
|
600 |
||
601 |
The name of the MySQL client package to install. |
|
602 |
||
603 |
### Defines |
|
604 |
||
605 |
#### mysql::db |
|
606 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
607 |
``` |
28 | 608 |
mysql_database { 'information_schema': |
609 |
ensure => 'present', |
|
610 |
charset => 'utf8', |
|
611 |
collate => 'utf8_swedish_ci', |
|
612 |
} |
|
613 |
mysql_database { 'mysql': |
|
614 |
ensure => 'present', |
|
615 |
charset => 'latin1', |
|
616 |
collate => 'latin1_swedish_ci', |
|
617 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
618 |
``` |
28 | 619 |
|
620 |
##### `user` |
|
621 |
||
622 |
The user for the database you're creating. |
|
623 |
||
624 |
##### `password` |
|
625 |
||
626 |
The password for $user for the database you're creating. |
|
627 |
||
628 |
##### `dbname` |
|
629 |
||
630 |
The name of the database to create. Defaults to $name. |
|
631 |
||
632 |
##### `charset` |
|
633 |
||
634 |
The character set for the database. Defaults to 'utf8'. |
|
635 |
||
636 |
##### `collate` |
|
637 |
||
638 |
The collation for the database. Defaults to 'utf8_general_ci'. |
|
639 |
||
640 |
##### `host` |
|
641 |
||
642 |
The host to use as part of user@host for grants. Defaults to 'localhost'. |
|
643 |
||
644 |
##### `grant` |
|
645 |
||
646 |
The privileges to be granted for user@host on the database. Defaults to 'ALL'. |
|
647 |
||
648 |
##### `sql` |
|
649 |
||
650 |
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. |
|
651 |
||
652 |
##### `enforce_sql` |
|
653 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
654 |
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. |
28 | 655 |
|
656 |
##### `ensure` |
|
657 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
658 |
Specifies whether to create the database. Valid values are 'present', 'absent'. Defaults to 'present'. |
28 | 659 |
|
660 |
##### `import_timeout` |
|
661 |
||
662 |
Timeout, in seconds, for loading the sqlfiles. Defaults to '300'. |
|
663 |
||
664 |
### Types |
|
665 |
||
666 |
#### mysql_database |
|
667 |
||
668 |
`mysql_database` creates and manages databases within MySQL. |
|
669 |
||
670 |
##### `ensure` |
|
671 |
||
672 |
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'. |
|
673 |
||
674 |
##### `name` |
|
675 |
||
676 |
The name of the MySQL database to manage. |
|
677 |
||
678 |
##### `charset` |
|
679 |
||
680 |
The CHARACTER SET setting for the database. Defaults to ':utf8'. |
|
681 |
||
682 |
##### `collate` |
|
683 |
||
684 |
The COLLATE setting for the database. Defaults to ':utf8_general_ci'. |
|
685 |
||
686 |
#### mysql_user |
|
687 |
||
688 |
Creates and manages user grants within MySQL. |
|
689 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
690 |
``` |
28 | 691 |
mysql_user { 'root@127.0.0.1': |
692 |
ensure => 'present', |
|
693 |
max_connections_per_hour => '0', |
|
694 |
max_queries_per_hour => '0', |
|
695 |
max_updates_per_hour => '0', |
|
696 |
max_user_connections => '0', |
|
697 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
698 |
``` |
28 | 699 |
|
700 |
You can also specify an authentication plugin. |
|
701 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
702 |
``` |
28 | 703 |
mysql_user{ 'myuser'@'localhost': |
704 |
ensure => 'present', |
|
705 |
plugin => 'unix_socket', |
|
706 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
707 |
``` |
28 | 708 |
|
709 |
##### `name` |
|
710 |
||
711 |
The name of the user, as 'username@hostname' or username@hostname. |
|
712 |
||
713 |
##### `password_hash` |
|
714 |
||
715 |
The user's password hash of the user. Use mysql_password() for creating such a hash. |
|
716 |
||
717 |
##### `max_user_connections` |
|
718 |
||
719 |
Maximum concurrent connections for the user. Must be an integer value. A value of '0' specifies no (or global) limit. |
|
720 |
||
721 |
##### `max_connections_per_hour` |
|
722 |
||
723 |
Maximum connections per hour for the user. Must be an integer value. A value of '0' specifies no (or global) limit. |
|
724 |
||
725 |
##### `max_queries_per_hour` |
|
726 |
||
727 |
Maximum queries per hour for the user. Must be an integer value. A value of '0' specifies no (or global) limit. |
|
728 |
||
729 |
##### `max_updates_per_hour` |
|
730 |
||
731 |
Maximum updates per hour for the user. Must be an integer value. A value of '0' specifies no (or global) limit. |
|
732 |
||
733 |
||
734 |
#### mysql_grant |
|
735 |
||
736 |
`mysql_grant` creates grant permissions to access databases within |
|
737 |
MySQL. To create grant permissions to access databases with MySQL, use it you must create the title of the resource as shown below, |
|
738 |
following the pattern of `username@hostname/database.table`: |
|
739 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
740 |
``` |
28 | 741 |
mysql_grant { 'root@localhost/*.*': |
742 |
ensure => 'present', |
|
743 |
options => ['GRANT'], |
|
744 |
privileges => ['ALL'], |
|
745 |
table => '*.*', |
|
746 |
user => 'root@localhost', |
|
747 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
748 |
``` |
28 | 749 |
|
750 |
It is possible to specify privileges down to the column level: |
|
751 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
752 |
``` |
28 | 753 |
mysql_grant { 'root@localhost/mysql.user': |
754 |
ensure => 'present', |
|
755 |
privileges => ['SELECT (Host, User)'], |
|
756 |
table => 'mysql.user', |
|
757 |
user => 'root@localhost', |
|
758 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
759 |
``` |
28 | 760 |
|
761 |
##### `ensure` |
|
762 |
||
763 |
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'. |
|
764 |
||
765 |
##### `name` |
|
766 |
||
767 |
Name to describe the grant. Must in a 'user/table' format. |
|
768 |
||
769 |
##### `privileges` |
|
770 |
||
771 |
Privileges to grant the user. |
|
772 |
||
773 |
##### `table` |
|
774 |
||
775 |
The table to which privileges are applied. |
|
776 |
||
777 |
##### `user` |
|
778 |
||
779 |
User to whom privileges are granted. |
|
780 |
||
781 |
##### `options` |
|
782 |
||
783 |
MySQL options to grant. Optional. |
|
784 |
||
785 |
#### mysql_plugin |
|
786 |
||
787 |
`mysql_plugin` can be used to load plugins into the MySQL Server. |
|
788 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
789 |
``` |
28 | 790 |
mysql_plugin { 'auth_socket': |
791 |
ensure => 'present', |
|
792 |
soname => 'auth_socket.so', |
|
793 |
} |
|
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
794 |
``` |
28 | 795 |
|
796 |
##### `ensure` |
|
797 |
||
798 |
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'. |
|
799 |
||
800 |
##### `name` |
|
801 |
||
802 |
The name of the MySQL plugin to manage. |
|
803 |
||
804 |
##### `soname` |
|
805 |
||
806 |
The library file name. |
|
807 |
||
146
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
808 |
#### `mysql_datadir` |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
809 |
|
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
810 |
Initializes the MySQL data directory with version specific code. Pre MySQL 5.7.6 |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
811 |
it uses mysql_install_db. After MySQL 5.7.6 it uses mysqld --initialize-insecure. |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
812 |
|
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
813 |
Insecure initialization is needed, as mysqld version 5.7 introduced "secure by default" mode. |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
814 |
This means MySQL generates a random password and writes it to STDOUT. This means puppet |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
815 |
can never accesss the database server afterwards, as no credencials are available. |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
816 |
|
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
817 |
This type is an internal type and should not be called directly. |
dc4d1cdc47e0
first implementation of handle install. Need refinement
ymh <ymh.work@gmail.com>
parents:
28
diff
changeset
|
818 |
|
28 | 819 |
### Facts |
820 |
||
821 |
#### `mysql_version` |
|
822 |
||
823 |
Determines the MySQL version by parsing the output from `mysql --version` |
|
824 |
||
825 |
#### `mysql_server_id` |
|
826 |
||
827 |
Generates a unique id, based on the node's MAC address, which can be used as |
|
828 |
`server_id`. This fact will *always* return `0` on nodes that have only |
|
829 |
loopback interfaces. Because those nodes aren't connected to the outside world, this shouldn't cause any conflicts. |
|
830 |
||
831 |
## Limitations |
|
832 |
||
833 |
This module has been tested on: |
|
834 |
||
835 |
* RedHat Enterprise Linux 5, 6, 7 |
|
836 |
* Debian 6, 7 |
|
837 |
* CentOS 5, 6, 7 |
|
838 |
* Ubuntu 10.04, 12.04, 14.04 |
|
839 |
* Scientific Linux 5, 6 |
|
840 |
* SLES 11 |
|
841 |
||
842 |
Testing on other platforms has been minimal and cannot be guaranteed. |
|
843 |
||
844 |
## Development |
|
845 |
||
846 |
Puppet Labs modules on the Puppet Forge are open projects, and community |
|
847 |
contributions are essential for keeping them great. We can't access the |
|
848 |
huge number of platforms and myriad of hardware, software, and deployment |
|
849 |
configurations that Puppet is intended to serve. |
|
850 |
||
851 |
We want to keep it as easy as possible to contribute changes so that our |
|
852 |
modules work in your environment. There are a few guidelines that we need |
|
853 |
contributors to follow so that we can have a chance of keeping on top of things. |
|
854 |
||
855 |
Check out our the complete [module contribution guide](https://docs.puppetlabs.com/forge/contributing.html). |
|
856 |
||
857 |
### Authors |
|
858 |
||
859 |
This module is based on work by David Schmitt. The following contributors have contributed to this module (beyond Puppet Labs): |
|
860 |
||
861 |
* Larry Ludwig |
|
862 |
* Christian G. Warden |
|
863 |
* Daniel Black |
|
864 |
* Justin Ellison |
|
865 |
* Lowe Schmidt |
|
866 |
* Matthias Pigulla |
|
867 |
* William Van Hevelingen |
|
868 |
* Michael Arnold |
|
869 |
* Chris Weyl |
|
870 |
* Daniƫl van Eeden |
|
871 |