puppetlabs/puppetlabs-mysql — pull request #567 by buzzdeee (2014-09-14 22:26:59+00:00)
Title: Add OpenBSD support.

This is a first step in OpenBSD support, tested with mysql-server-5.1.73p0v0 package on OpenBSD 5.6-current, using the following configuration stored in hiera.

mysql::server::root_password: topsecret
mysql::server::manage_config_file: true
mysql::server::purge_conf_dir: true
mysql::server::package_ensure: present
mysql::server::service_enabled: true
mysql::server::remove_default_accounts: true
mysql::server::users:
'dashboard@localhost':
ensure: present
max_connections_per_hour: 0
max_queries_per_hour: 0
max_updates_per_hour: 0
max_user_connections: 0
password_hash: '*TOPSECRETTOPSECRETTOPSECRET'
mysql::server::grants:
'dashboard@localhost/dashboard_production.*':
ensure: present
options:
- GRANT
privileges:
- ALL
table: 'dashboard_production.*'
user: dashboard@localhost
mysql::server::databases:
dashboard_production:
ensure: present
charset: utf8
mysql::server::override_options:
mysqld:
user: _mysql
datadir: /var/mysql

The odds are that I have to use the mysql::server::override_options :(
Fixing that, is for another diff, in order to keep this one clean and easier to review.

The change to server/service.pp is because there is no 'mysql' user and group, but _mysql user and _mysql group.
Another solution would be to add a $mysqlgroup variable to mysql::params list and use that.
However, the $mysql::params::log_error file is owned by _mysql:_mysql on my OpenBSD system instead of the root_group.

This is only a first step, that allowed me to create a database.
- Further steps I'd look into would be:
* get rid of the currently required usage of override_options
* introduce a $mysqluser and $mysqlgroup to params.pp and use those throughout the classes
* in other places, i.e. the backup config, there the group root is hardcoded, but on OpenBSD there is no group root, but wheel, so use the $root_group there