refactor things for >2.7
This commit is contained in:
parent
7f4ae6753f
commit
e4ca510b7c
7 changed files with 113 additions and 113 deletions
|
@ -1,6 +1,6 @@
|
|||
class mysql::client::ruby {
|
||||
|
||||
case $operatingsystem {
|
||||
case $::operatingsystem {
|
||||
debian: { include mysql::client::ruby::debian }
|
||||
}
|
||||
|
||||
|
|
|
@ -11,21 +11,21 @@ define mysql::default_database(
|
|||
'absent' => $name,
|
||||
default => $username
|
||||
}
|
||||
mysql_database{"$name":
|
||||
mysql_database{$name:
|
||||
ensure => $ensure
|
||||
}
|
||||
if $password == 'absent' and $ensure != 'absent' {
|
||||
info("we don't create the user for database: ${name}")
|
||||
$grant_require = Mysql_database["$name"]
|
||||
$grant_require = Mysql_database[$name]
|
||||
} else {
|
||||
mysql_user{"${real_username}@${host}":
|
||||
ensure => $ensure,
|
||||
require => [
|
||||
Mysql_database["$name"]
|
||||
Mysql_database[$name]
|
||||
],
|
||||
}
|
||||
$grant_require = [
|
||||
Mysql_database["$name"],
|
||||
Mysql_database[$name],
|
||||
Mysql_user["${real_username}@${host}"]
|
||||
]
|
||||
if $ensure == 'present' {
|
||||
|
@ -33,7 +33,7 @@ define mysql::default_database(
|
|||
password_hash => $password ? {
|
||||
'trocla' => trocla("mysql_${real_username}",'mysql'),
|
||||
default => $password_is_encrypted ? {
|
||||
true => "$password",
|
||||
true => $password,
|
||||
default => mysql_password("$password")
|
||||
},
|
||||
},
|
||||
|
@ -42,7 +42,7 @@ define mysql::default_database(
|
|||
}
|
||||
if $ensure == 'present' {
|
||||
mysql_grant{"${real_username}@${host}/${name}":
|
||||
privileges => "$privileges",
|
||||
privileges => $privileges,
|
||||
require => $grant_require,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class mysql::devel{
|
||||
package{"mysql-devel.${architecture}":
|
||||
ensure => present,
|
||||
}
|
||||
package{"mysql-devel.${::architecture}":
|
||||
ensure => present,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,14 +3,14 @@
|
|||
# class to install mysql-server
|
||||
# in a disabled way.
|
||||
class mysql::disable {
|
||||
package{'mysql-server':
|
||||
ensure => installed,
|
||||
}
|
||||
package{'mysql-server':
|
||||
ensure => installed,
|
||||
}
|
||||
|
||||
service {mysql:
|
||||
ensure => stopped,
|
||||
enable => false,
|
||||
hasstatus => true,
|
||||
require => Package['mysql-server'],
|
||||
}
|
||||
service {mysql:
|
||||
ensure => stopped,
|
||||
enable => false,
|
||||
hasstatus => true,
|
||||
require => Package['mysql-server'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
class mysql::server {
|
||||
|
||||
case $::operatingsystem {
|
||||
gentoo: { include mysql::server::gentoo }
|
||||
centos: { include mysql::server::centos }
|
||||
debian: { include mysql::server::debian }
|
||||
default: { include mysql::server::base }
|
||||
}
|
||||
|
||||
if hiera('use_munin',false) {
|
||||
case $::operatingsystem {
|
||||
gentoo: { include mysql::server::gentoo }
|
||||
centos: { include mysql::server::centos }
|
||||
debian: { include mysql::server::debian }
|
||||
default: { include mysql::server::base }
|
||||
debian: { include mysql::server::munin::debian }
|
||||
default: { include mysql::server::munin::default }
|
||||
}
|
||||
}
|
||||
|
||||
if hiera('use_munin',false) {
|
||||
case $::operatingsystem {
|
||||
debian: { include mysql::server::munin::debian }
|
||||
default: { include mysql::server::munin::default }
|
||||
}
|
||||
if hiera('use_nagios',false) {
|
||||
case hiera('nagios_check_mysql',false) {
|
||||
false: { info("We don't do nagioschecks for mysql on ${::fqdn}" ) }
|
||||
default: { include mysql::server::nagios }
|
||||
}
|
||||
}
|
||||
|
||||
if hiera('use_nagios',false) {
|
||||
case hiera('nagios_check_mysql',false) {
|
||||
false: { info("We don't do nagioschecks for mysql on ${::fqdn}" ) }
|
||||
default: { include mysql::server::nagios }
|
||||
}
|
||||
}
|
||||
|
||||
if hiera('use_shorewall',false) {
|
||||
include shorewall::rules::mysql
|
||||
}
|
||||
if hiera('use_shorewall',false) {
|
||||
include shorewall::rules::mysql
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class mysql::server::account_security {
|
||||
# some installations have some default users which are not required.
|
||||
# We remove them here. You can subclass this class to overwrite this behavior.
|
||||
mysql_user{ [ "root@${fqdn}", "root@127.0.0.1", "@${fqdn}", "@localhost", "@%" ]:
|
||||
ensure => 'absent',
|
||||
require => Service['mysql'],
|
||||
}
|
||||
# some installations have some default users which are not required.
|
||||
# We remove them here. You can subclass this class to overwrite this behavior.
|
||||
mysql_user{ [ "root@${::fqdn}", "root@127.0.0.1", "@${::fqdn}", "@localhost", "@%" ]:
|
||||
ensure => 'absent',
|
||||
require => Service['mysql'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,81 +1,81 @@
|
|||
class mysql::server::base {
|
||||
package { mysql-server:
|
||||
ensure => present,
|
||||
}
|
||||
file { 'mysql_main_cnf':
|
||||
path => '/etc/mysql/my.cnf',
|
||||
source => [
|
||||
"puppet:///modules/site-mysql/${::fqdn}/my.cnf",
|
||||
"puppet:///modules/site-mysql/my.cnf.${::operatingsystem}.{lsbdistcodename}",
|
||||
"puppet:///modules/site-mysql/my.cnf.${::operatingsystem}",
|
||||
"puppet:///modules/site-mysql/my.cnf",
|
||||
"puppet:///modules/mysql/config/my.cnf.${::operatingsystem}.{lsbdistcodename}",
|
||||
"puppet:///modules/mysql/config/my.cnf.${::operatingsystem}",
|
||||
"puppet:///modules/mysql/config/my.cnf"
|
||||
],
|
||||
ensure => file,
|
||||
require => Package['mysql-server'],
|
||||
notify => Service['mysql'],
|
||||
owner => root, group => 0, mode => 0644;
|
||||
}
|
||||
package { mysql-server:
|
||||
ensure => present,
|
||||
}
|
||||
file { 'mysql_main_cnf':
|
||||
path => '/etc/mysql/my.cnf',
|
||||
source => [
|
||||
"puppet:///modules/site_mysql/${::fqdn}/my.cnf",
|
||||
"puppet:///modules/site_mysql/my.cnf.${::operatingsystem}.{lsbdistcodename}",
|
||||
"puppet:///modules/site_mysql/my.cnf.${::operatingsystem}",
|
||||
"puppet:///modules/site_mysql/my.cnf",
|
||||
"puppet:///modules/mysql/config/my.cnf.${::operatingsystem}.{lsbdistcodename}",
|
||||
"puppet:///modules/mysql/config/my.cnf.${::operatingsystem}",
|
||||
"puppet:///modules/mysql/config/my.cnf"
|
||||
],
|
||||
ensure => file,
|
||||
require => Package['mysql-server'],
|
||||
notify => Service['mysql'],
|
||||
owner => root, group => 0, mode => 0644;
|
||||
}
|
||||
|
||||
file { 'mysql_data_dir':
|
||||
path => '/var/lib/mysql/data',
|
||||
ensure => directory,
|
||||
require => Package['mysql-server'],
|
||||
before => File['mysql_main_cnf'],
|
||||
owner => mysql, group => mysql, mode => 0755;
|
||||
}
|
||||
file { 'mysql_data_dir':
|
||||
path => '/var/lib/mysql/data',
|
||||
ensure => directory,
|
||||
require => Package['mysql-server'],
|
||||
before => File['mysql_main_cnf'],
|
||||
owner => mysql, group => mysql, mode => 0755;
|
||||
}
|
||||
|
||||
file { 'mysql_ibdata1':
|
||||
path => '/var/lib/mysql/data/ibdata1',
|
||||
ensure => file,
|
||||
require => Package['mysql-server'],
|
||||
before => File['mysql_setmysqlpass.sh'],
|
||||
owner => mysql, group => mysql, mode => 0660;
|
||||
}
|
||||
file { 'mysql_ibdata1':
|
||||
path => '/var/lib/mysql/data/ibdata1',
|
||||
ensure => file,
|
||||
require => Package['mysql-server'],
|
||||
before => File['mysql_setmysqlpass.sh'],
|
||||
owner => mysql, group => mysql, mode => 0660;
|
||||
}
|
||||
|
||||
file { 'mysql_setmysqlpass.sh':
|
||||
path => '/usr/local/sbin/setmysqlpass.sh',
|
||||
source => "puppet:///modules/mysql/scripts/${::operatingsystem}/setmysqlpass.sh",
|
||||
require => Package['mysql-server'],
|
||||
owner => root, group => 0, mode => 0500;
|
||||
}
|
||||
file { 'mysql_setmysqlpass.sh':
|
||||
path => '/usr/local/sbin/setmysqlpass.sh',
|
||||
source => "puppet:///modules/mysql/scripts/${::operatingsystem}/setmysqlpass.sh",
|
||||
require => Package['mysql-server'],
|
||||
owner => root, group => 0, mode => 0500;
|
||||
}
|
||||
|
||||
file { 'mysql_root_cnf':
|
||||
path => '/root/.my.cnf',
|
||||
content => template('mysql/root/my.cnf.erb'),
|
||||
require => [ Package['mysql-server'] ],
|
||||
owner => root, group => 0, mode => 0400,
|
||||
notify => Exec['mysql_set_rootpw'],
|
||||
}
|
||||
file { 'mysql_root_cnf':
|
||||
path => '/root/.my.cnf',
|
||||
content => template('mysql/root/my.cnf.erb'),
|
||||
require => [ Package['mysql-server'] ],
|
||||
owner => root, group => 0, mode => 0400,
|
||||
notify => Exec['mysql_set_rootpw'],
|
||||
}
|
||||
|
||||
exec { 'mysql_set_rootpw':
|
||||
command => '/usr/local/sbin/setmysqlpass.sh',
|
||||
unless => "mysqladmin -uroot status > /dev/null",
|
||||
require => [ File['mysql_setmysqlpass.sh'], Package['mysql-server'] ],
|
||||
refreshonly => true,
|
||||
}
|
||||
exec { 'mysql_set_rootpw':
|
||||
command => '/usr/local/sbin/setmysqlpass.sh',
|
||||
unless => "mysqladmin -uroot status > /dev/null",
|
||||
require => [ File['mysql_setmysqlpass.sh'], Package['mysql-server'] ],
|
||||
refreshonly => true,
|
||||
}
|
||||
|
||||
if hiera('mysql_backup_cron',false) {
|
||||
include mysql::server::cron::backup
|
||||
}
|
||||
if hiera('mysql_backup_cron',false) {
|
||||
include mysql::server::cron::backup
|
||||
}
|
||||
|
||||
if hiera('mysql_optimize_cron',false) {
|
||||
include mysql::server::cron::optimize
|
||||
}
|
||||
if hiera('mysql_optimize_cron',false) {
|
||||
include mysql::server::cron::optimize
|
||||
}
|
||||
|
||||
service { 'mysql':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
hasstatus => true,
|
||||
require => Package['mysql-server'],
|
||||
}
|
||||
service { 'mysql':
|
||||
ensure => running,
|
||||
enable => true,
|
||||
hasstatus => true,
|
||||
require => Package['mysql-server'],
|
||||
}
|
||||
|
||||
include mysql::server::account_security
|
||||
include mysql::server::account_security
|
||||
|
||||
# Collect all databases and users
|
||||
Mysql_database<<| tag == "mysql_${::fqdn}" |>>
|
||||
Mysql_user<<| tag == "mysql_${::fqdn}" |>>
|
||||
Mysql_grant<<| tag == "mysql_${::fqdn}" |>>
|
||||
# Collect all databases and users
|
||||
Mysql_database<<| tag == "mysql_${::fqdn}" |>>
|
||||
Mysql_user<<| tag == "mysql_${::fqdn}" |>>
|
||||
Mysql_grant<<| tag == "mysql_${::fqdn}" |>>
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue