fuel-library/deployment/puppet/mysql
Bartłomiej Piotrowski eab5589b87 Make MySQL ignore lost+found directory in its datadir
This commit introduces optional ignore_db_dirs parameter that can be passed to
mysql::server. It is expected to be an array and is empty by default.

The backport also adds mounts fact that has been introduced in
I8a2cb4bd8d0b6070400d13e25d2310f4777b9faf.

Cherry-picked from: fb100ee828
Change-Id: Ic8815b89fea41182692f9f8fafd07bbe6ca15af6
Closes-Bug: 1484552
2015-10-09 13:23:47 +02:00
..
examples Remove stolen examples 2013-02-28 21:46:19 +04:00
files Move OCF scripts to ocf dir 2014-11-07 18:11:40 +02:00
lib/puppet Refactor DB creation 2015-07-02 17:51:21 +02:00
manifests Make MySQL ignore lost+found directory in its datadir 2015-10-09 13:23:47 +02:00
spec Remove the last cs_shadow 2014-11-24 11:06:58 +00:00
templates Make MySQL ignore lost+found directory in its datadir 2015-10-09 13:23:47 +02:00
tests Fix mysql tests 2013-07-25 17:32:20 +04:00
.fixtures.yml Initial commit 2012-09-07 17:38:58 -07:00
.gemfile Initial commit 2012-09-07 17:38:58 -07:00
.gitignore Ignore metadata.json 2013-01-11 14:09:25 +04:00
.project Add project files 2013-01-10 18:37:05 +04:00
.rspec Fix mysql tests 2013-07-25 17:32:20 +04:00
.travis.yml Initial commit 2012-09-07 17:38:58 -07:00
CHANGELOG Initial commit 2012-09-07 17:38:58 -07:00
LICENSE Initial commit 2012-09-07 17:38:58 -07:00
Modulefile Initial commit 2012-09-07 17:38:58 -07:00
README.md Initial commit 2012-09-07 17:38:58 -07:00
Rakefile Initial commit 2012-09-07 17:38:58 -07:00
TODO Initial commit 2012-09-07 17:38:58 -07:00

README.md

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'] ,
}

A resource default can be specified to handle dependency:

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