No description
Find a file
Hunter Haugen fe3d6c3088 Release 0.5.0
Changes:
- Add puppetlabs/stdlib as requirement
- Add validation for mysql privs in provider
- Add `pidfile` parameter to mysql::config
- Add `ensure` parameter to mysql::db
- Add Amazon linux support
- Change `bind_address` parameter to be optional in my.cnf template

Bugfixes:
- Quote root passwords
2012-08-23 19:19:40 -07:00
files (#12412) mysqltuner.pl update 2012-02-04 07:08:08 +11:00
lib/puppet Revert "Merge pull request #90 from emonty/master" 2012-08-15 18:03:37 -07:00
manifests Change list passed into validate_re to a stringe 2012-08-23 10:04:30 +01:00
spec Merge pull request #101 from martasd/manage-db-status 2012-08-22 11:30:46 -07:00
templates Update bind_address conditional for false 2012-08-23 18:30:37 -07:00
tests Merge pull request #64 from runningman/backup 2012-05-10 22:44:52 -07:00
.fixtures.yml Added an option to specify db status. 2012-08-21 15:40:42 -07:00
.gemfile Switch to using the puppetlabs_spec_helper gem for common files 2012-05-31 15:32:36 -07:00
.gitignore Update the module to the new layout for easier testing and packaging 2012-05-24 16:55:22 -07:00
.travis.yml Switch to using the puppetlabs_spec_helper gem for common files 2012-05-31 15:32:36 -07:00
CHANGELOG Release 0.5.0 2012-08-23 19:19:40 -07:00
LICENSE Added documentation and license to module. 2011-05-31 20:47:19 -07:00
Modulefile Release 0.5.0 2012-08-23 19:19:40 -07:00
Rakefile Switch to using the puppetlabs_spec_helper gem for common files 2012-05-31 15:32:36 -07:00
README.md Clarify how to grant specific privileges with database_grant 2012-08-21 10:42:20 -07:00
TODO added some additional TODOS 2011-06-03 13:27:44 -07:00

Mysql module for Puppet

This module manages mysql on Linux (RedHat/Debian) distros. A native mysql provider implements database resource type to handle database, database user, and database permission.

Description

This module uses the fact osfamily which is supported by Facter 1.6.1+. If you do not have facter 1.6.1 in your environment, the following manifests will provide the same functionality in site.pp (before declaring any node):

if ! $::osfamily {
  case $::operatingsystem {
    'RedHat', 'Fedora', 'CentOS', 'Scientific', 'SLC', 'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS', 'OEL': {
      $osfamily = 'RedHat'
    }
    'ubuntu', 'debian': {
      $osfamily = 'Debian'
    }
    'SLES', 'SLED', 'OpenSuSE', 'SuSE': {
      $osfamily = 'Suse'
    }
    'Solaris', 'Nexenta': {
      $osfamily = 'Solaris'
    }
    default: {
      $osfamily = $::operatingsystem
    }
  }
}

This module depends on creates_resources function which is introduced in Puppet 2.7. Users on puppet 2.6 can use the following module which provides this functionality:

http://github.com/puppetlabs/puppetlabs-create_resources

This module is based on work by David Schmitt. The following contributor have contributed patches to this module (beyond Puppet Labs):

  • Christian G. Warden
  • Daniel Black
  • Justin Ellison
  • Lowe Schmidt
  • Matthias Pigulla
  • William Van Hevelingen
  • Michael Arnold

Usage

mysql

Installs the mysql-client package.

class { 'mysql': }

mysql::java

Installs mysql bindings for java.

class { 'mysql::java': }

mysql::python

Installs mysql bindings for python.

class { 'mysql::python': }

mysql::ruby

Installs mysql bindings for ruby.

class { 'mysql::ruby': }

mysql::server

Installs mysql-server packages, configures my.cnf and starts mysqld service:

class { 'mysql::server':
  config_hash => { 'root_password' => 'foo' }
}

Database login information stored in /root/.my.cnf.

mysql::db

Creates a database with a user and assign some privileges.

mysql::db { 'mydb':
  user     => 'myuser',
  password => 'mypass',
  host     => 'localhost',
  grant    => ['all'],
}

mysql::backup

Installs a mysql backup script, cronjob, and priviledged backup user.

class { 'mysql::backup':
  backupuser     => 'myuser',
  backuppassword => 'mypassword',
  backupdir      => '/tmp/backups',
}

Providers for database types:

MySQL provider supports puppet resources command:

$ puppet resource database
database { 'information_schema':
  ensure  => 'present',
  charset => 'utf8',
}
database { 'mysql':
  ensure  => 'present',
  charset => 'latin1',
}

The custom resources can be used in any other manifests:

database { 'mydb':
  charset => 'latin1',
}

database_user { 'bob@localhost':
  password_hash => mysql_password('foo')
}

database_grant { 'user@localhost/database':
  privileges => ['all'] ,
  # Or specify individual privileges with columns from the mysql.db table:
  # privileges => ['Select_priv', 'Insert_priv', 'Update_priv', 'Delete_priv']
}

A resource default can be specified to handle dependency:

Database {
  require => Class['mysql::server'],
}