Various adjustments to classes to align with refactored work.
Handful of changes here, such as removing flush (so that mysql_user can be used for root password changes) and other tweaks here. Add time option to mysql::backup.
This commit is contained in:
parent
3f9297e10e
commit
4d6962e868
4 changed files with 24 additions and 110 deletions
|
@ -81,11 +81,6 @@ Puppet::Type.type(:mysql_user).provide(:mysql) do
|
|||
@property_hash[:ensure] == :present || false
|
||||
end
|
||||
|
||||
def flush
|
||||
@property_hash.clear
|
||||
mysql([defaults_file, '-NBe', 'FLUSH PRIVILEGES'].compact)
|
||||
end
|
||||
|
||||
##
|
||||
## MySQL user properties
|
||||
##
|
||||
|
|
|
@ -1,32 +1,4 @@
|
|||
# Class: mysql::backup
|
||||
#
|
||||
# This module handles ...
|
||||
#
|
||||
# Parameters:
|
||||
# [*backupuser*] - The name of the mysql backup user.
|
||||
# [*backuppassword*] - The password of the mysql backup user.
|
||||
# [*backupdir*] - The target directory of the mysqldump.
|
||||
# [*backupcompress*] - Boolean to compress backup with bzip2.
|
||||
# [*backuprotate*] - Number of backups to keep. Default 30
|
||||
# [*backupdatabases*] - Specify databases to back up as array (default all)
|
||||
# [*file_per_database*] - Boolean to dump each database to its own file.
|
||||
# [*delete_before_dump*] - Clean existing backups before creating new
|
||||
#
|
||||
# Actions:
|
||||
# GRANT SELECT, RELOAD, LOCK TABLES ON *.* TO 'user'@'localhost'
|
||||
# IDENTIFIED BY 'password';
|
||||
#
|
||||
# Requires:
|
||||
# Class['mysql::config']
|
||||
#
|
||||
# Sample Usage:
|
||||
# class { 'mysql::backup':
|
||||
# backupuser => 'myuser',
|
||||
# backuppassword => 'mypassword',
|
||||
# backupdir => '/tmp/backups',
|
||||
# backupcompress => true,
|
||||
# }
|
||||
#
|
||||
# Deprecated class
|
||||
class mysql::backup (
|
||||
$backupuser,
|
||||
$backuppassword,
|
||||
|
@ -36,48 +8,24 @@ class mysql::backup (
|
|||
$delete_before_dump = false,
|
||||
$backupdatabases = [],
|
||||
$file_per_database = false,
|
||||
$ensure = 'present'
|
||||
$ensure = 'present',
|
||||
$time = ['23', '5'],
|
||||
) {
|
||||
|
||||
mysql_user { "${backupuser}@localhost":
|
||||
ensure => $ensure,
|
||||
password_hash => mysql_password($backuppassword),
|
||||
provider => 'mysql',
|
||||
require => Class['mysql::server::config'],
|
||||
}
|
||||
crit("This class has been deprecated and callers should directly call
|
||||
mysql::server::backup now.")
|
||||
|
||||
mysql_grant { "${backupuser}@localhost/*.*":
|
||||
ensure => present,
|
||||
user => "${backupuser}@localhost",
|
||||
table => '*.*',
|
||||
privileges => [ 'SELECT', 'RELOAD', 'LOCK TABLES', 'SHOW VIEW' ],
|
||||
require => Mysql_user["${backupuser}@localhost"],
|
||||
}
|
||||
|
||||
cron { 'mysql-backup':
|
||||
ensure => $ensure,
|
||||
command => '/usr/local/sbin/mysqlbackup.sh',
|
||||
user => 'root',
|
||||
hour => 23,
|
||||
minute => 5,
|
||||
require => File['mysqlbackup.sh'],
|
||||
}
|
||||
|
||||
file { 'mysqlbackup.sh':
|
||||
ensure => $ensure,
|
||||
path => '/usr/local/sbin/mysqlbackup.sh',
|
||||
mode => '0700',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
content => template('mysql/mysqlbackup.sh.erb'),
|
||||
}
|
||||
|
||||
file { 'mysqlbackupdir':
|
||||
ensure => 'directory',
|
||||
path => $backupdir,
|
||||
mode => '0700',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
class { 'mysql::server::backup':
|
||||
ensure => $ensure,
|
||||
backupuser => $backupuser,
|
||||
backuppassword => $backuppassword,
|
||||
backupdir => $backupdir,
|
||||
backupcompress => $backupcompress,
|
||||
backuprotate => $backuprotate,
|
||||
delete_before_dump => $delete_before_dump,
|
||||
backupdatabases => $backupdatabases,
|
||||
file_per_database => $file_per_database,
|
||||
time => $time,
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,13 @@ class mysql::client (
|
|||
include '::mysql::client::install'
|
||||
|
||||
if $bindings_enable {
|
||||
include '::mysql::bindings'
|
||||
class { 'mysql::bindings':
|
||||
java_enable => true,
|
||||
perl_enable => true,
|
||||
php_enable => true,
|
||||
python_enable => true,
|
||||
ruby_enable => true,
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,39 +1,4 @@
|
|||
# Define: mysql::db
|
||||
#
|
||||
# This module creates database instances, a user, and grants that user
|
||||
# privileges to the database. It can also import SQL from a file in order to,
|
||||
# for example, initialize a database schema.
|
||||
#
|
||||
# Since it requires class mysql::server, we assume to run all commands as the
|
||||
# root mysql user against the local mysql server.
|
||||
#
|
||||
# Parameters:
|
||||
# [*title*] - mysql database name.
|
||||
# [*user*] - username to create and grant access.
|
||||
# [*password*] - user's password.
|
||||
# [*collate*] - database charset.
|
||||
# [*charset*] - database charset.
|
||||
# [*host*] - host for assigning privileges to user.
|
||||
# [*grant*] - array of privileges to grant user.
|
||||
# [*enforce_sql*] - whether to enforce or conditionally run sql on creation.
|
||||
# [*sql*] - sql statement to run.
|
||||
# [*ensure*] - specifies if a database is present or absent.
|
||||
#
|
||||
# Actions:
|
||||
#
|
||||
# Requires:
|
||||
#
|
||||
# class mysql::server
|
||||
#
|
||||
# Sample Usage:
|
||||
#
|
||||
# mysql::db { 'mydb':
|
||||
# user => 'my_user',
|
||||
# password => 'password',
|
||||
# host => $::hostname,
|
||||
# grant => ['all']
|
||||
# }
|
||||
#
|
||||
# See README.md for details.
|
||||
define mysql::db (
|
||||
$user,
|
||||
$password,
|
||||
|
|
Loading…
Reference in a new issue