Coder Social home page Coder Social logo

puppetlabs-mysql's Introduction

Mysql module for Puppet

Build Status

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.

Pluginsync needs to be enabled for this module to function properly. Read more about pluginsync in our docs

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 the 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::php

Installs mysql bindings for php

class { 'mysql::php': }

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

puppetlabs-mysql's People

Contributors

bodepd avatar hunner avatar nanliu avatar kbarber avatar razorsedge avatar justinellison avatar blkperl avatar savar avatar emonty avatar ccaum avatar pbrit avatar fcharlier avatar saz avatar frimik avatar stahnma avatar mpdude avatar jmchilton avatar derekhiggins avatar cwarden avatar agerlic avatar mcary avatar rdrgmnzs avatar richardc avatar reidmv avatar obilodeau avatar nikolavp avatar inkblot avatar kronn avatar haus avatar mattr- avatar

Watchers

Tom Barber avatar Paul Stoellberger avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.