Skip to content
This repository was archived by the owner on Jun 11, 2019. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@
# This is used by monitor, firewall and puppi (optional) components
# Can be defined also by the (top scope) variable $mysql_protocol
#
# [*install_mariadb*]
# Bool (default false). Not all distro's ship mariadb by default yet.
# Setting this directive to true forces the installation of mariadb.
#
# [*mariadb_package*]
# If mariadb is to be installed what package name to use.
#
# == Examples
#
Expand Down Expand Up @@ -258,7 +264,9 @@
$log_dir = params_lookup( 'log_dir' ),
$log_file = params_lookup( 'log_file' ),
$port = params_lookup( 'port' ),
$protocol = params_lookup( 'protocol' )
$protocol = params_lookup( 'protocol' ),
$install_mariadb = params_lookup( 'install_mariadb' ),
$mariadb_package = params_lookup( 'mariadb_package' ),
) inherits mysql::params {

$bool_source_dir_purge=any2bool($source_dir_purge)
Expand All @@ -270,6 +278,7 @@
$bool_puppi=any2bool($puppi)
$bool_firewall=any2bool($firewall)
$bool_debug=any2bool($debug)
$bool_install_mariadb=any2bool($install_mariadb)
$bool_audit_only=any2bool($audit_only)

### Root password setup
Expand Down Expand Up @@ -354,9 +363,20 @@
if $mysql::real_root_password != '' { include mysql::password }

### Managed resources
package { 'mysql':
ensure => $mysql::manage_package,
name => $mysql::package,
if $bool_install_mariadb {

include ::mysql::mariadb

package { 'mysql':
ensure => $mysql::manage_package,
name => $mysql::mariadb_package,
}

} else {
package { 'mysql':
ensure => $mysql::manage_package,
name => $mysql::package,
}
}

if $mysql::bool_absent == false {
Expand Down
58 changes: 58 additions & 0 deletions manifests/mariadb.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# [*version*]
# The minor version (X.Y) to install. Defaults to one of the
# latest if none is specified (this may be changed without notice).
#
# [*firewall*]
# Whether or not to configure the firewall for the repo and key server
#
class mysql::mariadb (
$version = $::mysql::version,
$firewall = $::mysql::bool_firewall,
$apt_mirror_url = 'http://mirrors.supportex.net',
$apt_key = '1BB943DB',
$apt_keyserver = 'keyserver.ubuntu.com',
) {

case $::operatingsystem {
/^(Debian|Ubuntu|Mint)$/: {

if ( ( $version == '' ) or ( $version == undef ) ) {
$minor_version = '10.0'
} else {
$minor_version = inline_template('<%=@version.to_s.match(/\d+.\d+/)[0] %>')
}

$distro_lc = inline_template("<%= scope.lookupvar('::operatingsystem').downcase %>")
$distro_url = "${apt_mirror_url}/mariadb/repo/${minor_version}/${distro_lc}"

apt::repository { 'mariadb':
url => $distro_url,
distro => $::lsbdistcodename,
repository => 'main',
key => $apt_key,
keyserver => $apt_keyserver,
before => Package['mysql']
}

if any2bool($firewall) {
firewall { 'mysql-repo-mariadb':
destination => [ 'keyserver.ubuntu.com', 'mirrors.supportex.net' ],
destination_v6 => [ 'keyserver.ubuntu.com', 'mirrors.supportex.net' ],
protocol => 'tcp',
port => 80,
direction => 'output',
}

Service['iptables'] -> Apt::Key[$apt_key]
Service['iptables'] -> Apt::Repository['mariadb']
}

}

default: {
fail('mysql::mariadb currently only supports debian-based systems')
}

}
}
5 changes: 5 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
$root_password = ''
$password_salt = ''

$install_mariadb = false
$mariadb_package = $::operatingsystem ? {
default => 'mariadb-server',
}

### Application related parameters

$package = $::operatingsystem ? {
Expand Down