Puppet Class: uhosting::profiles::mariadb
- Defined in:
- manifests/profiles/mariadb.pp
Overview
Class: uhosting::profiles::mariadb
Installs and manages MariaDB server It also creates databases, users, and grants coming from site hash.
Parameters
- root_password
-
Database root password. Mandatory.
Authors
Tobias Brunner <tobias.brunner@vshn.ch>
Copyright
Copyright 2015 Tobias Brunner, VSHN AG
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'manifests/profiles/mariadb.pp', line 19
class uhosting::profiles::mariadb (
$root_password,
) {
## Database Server Maria DB (fork of MySQL)
$mariadb_server_options = {
'mysqld' => {
'bind-address' => '127.0.0.1',
'skip_name_resolve' => '1',
'max_allowed_packet' => 36700160,
'max_connections' => 600,
'slow_query_log' => 0,
'character_set_server' => 'utf8',
'collation_server' => 'utf8_bin',
}
}
# Define APT source if not already there
::apt::source { 'mariadb':
comment => 'official MariaDB repo',
location => 'http://mariadb.kisiek.net/repo/10.0/ubuntu',
release => $::lsbdistcodename,
repos => 'main',
key => {
'id' => '199369E5404BD5FC7D2FE43BCBCB082A1BB943DB',
'server' => 'hkp://keyserver.ubuntu.com:80',
},
include => {
'src' => false,
'deb' => true,
}
}
# Install MariaDB client if not already there
class { '::mysql::client':
package_name => 'mariadb-client',
require => Apt::Source['mariadb'],
}
# Install MariaDB server
class { '::mysql::server':
root_password => $root_password,
includedir => undef,
package_name => 'mariadb-server',
override_options => $mariadb_server_options,
require => Apt::Source['mariadb'],
} ->
# Deletes default MySQL accounts
class { '::mysql::server::account_security': }
# install MySQL Tuner script. Source:
# https://github.com/major/MySQLTuner-perl
class { '::mysql::server::mysqltuner':
version => 'v1.4.0',
}
### Resources
## Get sites from hiera
$sitehash = hiera('uhosting::sites')
$sites = keys($sitehash)
## Create the databases
::uhosting::resources::mariadb { $sites:
data => $sitehash,
}
## Firewall settings
#firewall {
# '020 open MariaDB IPv4':
# dport => 3306,
# proto => 'tcp',
# action => 'accept';
# '020 open MariaDB IPv6':
# dport => 3306,
# proto => 'tcp',
# action => 'accept',
# provider => 'ip6tables';
#}
}
|