example42/puppet-mysql

Name: puppet-mysql

Owner: Example42

Description: Mysql Puppet Module

Created: 2012-02-26 08:40:41.0

Updated: 2017-07-19 16:21:34.0

Pushed: 2016-08-12 21:29:16.0

Homepage: http://www.example42.com

Size: 169

Language: Puppet

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Deprecation notice

This module was designed for Puppet versions 2 and 3. It should work also on Puppet 4 but doesn't use any of its features.

The current Puppet 3 compatible codebase is no longer actively maintained by example42.

Still, Pull Requests that fix bugs or introduce backwards compatible features will be accepted.

Puppet module: mysql

This is a Puppet mysql module from the second generation of Example42 Puppet Modules.

Made by Alessandro Franceschi / Lab42

Official site: http://www.example42.com

Official git repository: http://github.com/example42/puppet-mysql

Released under the terms of Apache 2 License.

This module requires functions provided by the Example42 Puppi module.

For detailed info about the logic and usage patterns of Example42 modules read README.usage on Example42 main modules set.

USAGE - Module specific
Create database and manage GRANT

The simplest way to create database is the following.

    mysql::grant { 'db1':
      mysql_user     => 'myusername',
      mysql_password => 'mypassword',
    }

This will create a MySQL database named 'db1' with a MySQL grant allowing full access to user 'myusername' with 'mypassword' password on local host.

Customize host source

If you want to customize the host the new user can connect from you have to use the 'mysql_host'.

    mysql::grant { 'db1':
      mysql_user     => 'myusername',
      mysql_password => 'mypassword',
      mysql_host     => '10.42.42.0/255.255.255.0',
    }

Here the whole 10.42.42.0/24 can connect.

Customize privileges

For privileges customization there is the 'mysql_privileges' parameter.

    mysql::grant { 'db1':
      mysql_user       => 'myusername',
      mysql_password   => 'mypassword',
      mysql_privileges => 'SELECT',
    }

The default grant privileges is 'ALL'.

Remove GRANT

Like for standard puppet resource you can use the 'ensure' parameter in order to remove a grant.

    mysql::grant { 'db1':
      ensure         => 'absent',
      mysql_user     => 'myusername',
      mysql_password => 'mypassword',
    }

This will ensure the 'myusername@localhost' grant is absent but not the database.

Load initial data

The mysql_db_init_query_file is an optional parameter allowing to specify a sql file. The execution of this SQL file will be triger only once at the creation time.

    mysql::grant { 'db1':
      ensure                   => 'absent',
      mysql_user               => 'myusername',
      mysql_password           => 'mypassword',
      mysql_db_init_query_file => '/full/path/to/the/schema.sql',
    }

NOTE: The SQL file should already be uploaded on mysql server host.

USAGE - Basic management
USAGE - Overrides and Customizations
USAGE - Hiera Support
l::template: 'modules/mysql/my.cnf.erb'
l::root_password: 'example42'
l::options:
rt: '3306'
nd-address: '127.0.0.1'
l::grant_hash:
b1':
mysql_user: 'myusername'
mysql_password: 'mypassword'
mysql_host: '10.42.42.0/255.255.255.0'
USAGE - Example42 extensions management

Build Status


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.