aboutsummaryrefslogtreecommitdiffstats
path: root/manifests/profile/base
diff options
context:
space:
mode:
authorEmilien Macchi <emilien@redhat.com>2016-07-11 11:02:36 -0400
committerEmilien Macchi <emilien@redhat.com>2016-07-13 14:17:37 -0400
commite74fa175564c8f27837a40398fff401b38898175 (patch)
treebab5977d62bc3df0a7dbc395e30f796272784a53 /manifests/profile/base
parentadc02fd625b6be1ee6529a4c7646e62d793a206a (diff)
Add MySQL profiles
Add MySQL profiles, for non-ha and ha scenarios. Change-Id: I7ddae28a6affd55c5bffc15d72226a18c708850e Closes-Bug: #1601853
Diffstat (limited to 'manifests/profile/base')
-rw-r--r--manifests/profile/base/database/mysql.pp85
1 files changed, 85 insertions, 0 deletions
diff --git a/manifests/profile/base/database/mysql.pp b/manifests/profile/base/database/mysql.pp
new file mode 100644
index 0000000..9552e10
--- /dev/null
+++ b/manifests/profile/base/database/mysql.pp
@@ -0,0 +1,85 @@
+# Copyright 2016 Red Hat, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# == Class: tripleo::profile::base::database::mysql
+#
+# MySQL profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+# (Optional) The current step in deployment. See tripleo-heat-templates
+# for more details.
+# Defaults to hiera('step')
+#
+# [*mysql_server_options*]
+# (Optional) Extras options to deploy MySQL. Useful when deploying Galera cluster.
+# Should be an hash.
+# Defaults to {}
+#
+# [*manage_resources*]
+# (Optional) Whether or not manage root user, root my.cnf, and service.
+# Defaults to true
+#
+# [*remove_default_accounts*]
+# (Optional) Whether or not remove default MySQL accounts.
+# Defaults to true
+#
+class tripleo::profile::base::database::mysql (
+ $step = hiera('step'),
+ $mysql_server_options = {},
+ $manage_resources = true,
+ $remove_default_accounts = true,
+) {
+
+ validate_hash($mysql_server_options)
+
+ # non-ha scenario
+ if $manage_resources {
+ $mysql_step = 2
+ } else {
+ # ha scenario
+ $mysql_step = 1
+ }
+ if hiera('step') >= $mysql_step {
+ if str2bool(hiera('enable_galera', true)) {
+ $mysql_config_file = '/etc/my.cnf.d/galera.cnf'
+ } else {
+ $mysql_config_file = '/etc/my.cnf.d/server.cnf'
+ }
+ # TODO Galara
+ # FIXME: due to https://bugzilla.redhat.com/show_bug.cgi?id=1298671 we
+ # set bind-address to a hostname instead of an ip address; to move Mysql
+ # from internal_api on another network we'll have to customize both
+ # MysqlNetwork and ControllerHostnameResolveNetwork in ServiceNetMap
+ $mysql_server_default = {
+ 'mysqld' => {
+ 'bind-address' => $::hostname,
+ 'max_connections' => hiera('mysql_max_connections'),
+ 'open_files_limit' => '-1',
+ }
+ }
+ $mysql_server_options_real = deep_merge($mysql_server_default, $mysql_server_options)
+ class { '::mysql::server':
+ config_file => $mysql_config_file,
+ override_options => $mysql_server_options_real,
+ create_root_user => $manage_resources,
+ create_root_my_cnf => $manage_resources,
+ service_manage => $manage_resources,
+ service_enabled => $manage_resources,
+ remove_default_accounts => $remove_default_accounts,
+ }
+ }
+
+}