summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-05-31 22:35:28 +0000
committerGerrit Code Review <review@openstack.org>2017-05-31 22:35:28 +0000
commit072fc5fb8800a4bb0180c1584616b57df0166510 (patch)
tree30edc3961f285b54f30184c7ad2d0578e0079a00
parent547d96d70db6e88eb2de44ac8212ed5dd5864692 (diff)
parentb555dc3ee570dc766da4d25be4d4bc55807141e4 (diff)
Merge "Create /etc/my.cnf.d/tripleo.cnf with proper bind-address" into stable/newton
-rw-r--r--manifests/profile/base/database/mysql/client.pp72
1 files changed, 72 insertions, 0 deletions
diff --git a/manifests/profile/base/database/mysql/client.pp b/manifests/profile/base/database/mysql/client.pp
new file mode 100644
index 0000000..f23b97d
--- /dev/null
+++ b/manifests/profile/base/database/mysql/client.pp
@@ -0,0 +1,72 @@
1# Copyright 2016 Red Hat, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14#
15# == Class: tripleo::profile::base::haproxy
16#
17# Loadbalancer profile for tripleo
18#
19# === Parameters
20#
21# [*mysql_read_default_file*]
22# (Optional) Name of the file that will be passed to pymysql connection strings
23# Defaults to hiera('tripleo::profile::base:database::mysql::read_default_file', '/etc/my.cnf.d/tripleo.cnf')
24#
25# [*mysql_read_default_group*]
26# (Optional) Name of the ini section to be passed to pymysql connection strings
27# Defaults to hiera('tripleo::profile::base:database::mysql::read_default_group', 'tripleo')
28#
29# [*mysql_client_bind_address*]
30# (Optional) Client IP address of the host that will be written in the mysql_read_default_file
31# Defaults to hiera('tripleo::profile::base:database::mysql::client_bind_address', undef)
32#
33# [*step*]
34# (Optional) The current step in deployment. See tripleo-heat-templates
35# for more details.
36# Defaults to hiera('step')
37#
38class tripleo::profile::base::database::mysql::client (
39 $mysql_read_default_file = hiera('tripleo::profile::base:database::mysql::read_default_file', '/etc/my.cnf.d/tripleo.cnf'),
40 $mysql_read_default_group = hiera('tripleo::profile::base:database::mysql::read_default_group', 'tripleo'),
41 $mysql_client_bind_address = hiera('tripleo::profile::base:database::mysql::client_bind_address', undef),
42 $step = hiera('step'),
43) {
44 if $step >= 1 {
45 # If the folder /etc/my.cnf.d does not exist (e.g. if mariadb is not
46 # present in the base image but installed as a package afterwards),
47 # create it. We do not want to touch the permissions in case it already
48 # exists due to the mariadb server package being pre-installed
49 # Note: We use exec instead of file in the case that the mysql class is
50 # included on this node as well (we'd get duplicate declaration in such a
51 # situation when using file)
52 if $mysql_client_bind_address {
53 $changes = [
54 "set ${mysql_read_default_group}/bind-address '${mysql_client_bind_address}'"
55 ]
56 } else {
57 $changes = [
58 "rm ${mysql_read_default_group}/bind-address"
59 ]
60 }
61 exec { 'directory-create-etc-my.cnf.d':
62 command => 'mkdir -p /etc/my.cnf.d',
63 path => ['/usr/bin', '/usr/sbin', '/bin', '/sbin'],
64 } ->
65 # Create /etc/my.cnf.d/tripleo.cnf with the [tripleo]bind-address=<IP of the node in the mysql network>
66 augeas { 'mysql-bind-address':
67 incl => $mysql_read_default_file,
68 lens => 'Puppet.lns',
69 changes => $changes,
70 }
71 }
72}