Added mysql database.

This commit is contained in:
Michael Krotscheck 2015-04-20 18:05:00 -07:00
parent 7d533c0cbb
commit f6f54e540d
7 changed files with 68 additions and 1 deletions

View File

@ -10,3 +10,4 @@ project_page 'https://github.com/openstack-ci/puppet-refstack'
## Add dependencies, if any:
dependency 'stankevich/python', '= 1.6.6'
dependency 'openstackci/vcsrepo', '= 0.0.8'
dependency 'puppetlabs/mysql', '= 0.6.1'

View File

@ -17,12 +17,20 @@
# This class installs and updates refstack in a continuous-deployment fashion
# directly from its git repositories.
#
class refstack () {
class refstack (
$mysql_database = 'refstack',
$mysql_user = 'refstack',
$mysql_user_password,
) {
# Configure the entire refstack instance. This does not install anything,
# but ensures that variables are consistent across all modules.
class { '::refstack::params':
mysql_database => $mysql_database,
mysql_user => $mysql_user,
mysql_user_password => $mysql_user_password,
}
include ::refstack::mysql
include ::refstack::api
}

39
manifests/mysql.pp Normal file
View File

@ -0,0 +1,39 @@
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# 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: refstack::mysql
#
# The Refstack MySQL manifest will install a standalone, localhost instance
# of mysql for refstack to connect to.
#
class refstack::mysql () {
require ::refstack::params
# Import parameters.
$mysql_database = $refstack::params::mysql_database
$mysql_user = $refstack::params::mysql_user
$mysql_user_password = $refstack::params::mysql_user_password
# Install MySQL
include mysql::server
# Add the storyboard database.
mysql::db { $mysql_database:
user => $mysql_user,
password => $mysql_user_password,
host => 'localhost',
grant => ['all'],
}
}

View File

@ -25,6 +25,13 @@ class refstack::params (
# The user under which refstack will run.
$user = 'refstack',
$group = 'refstack',
# [database] refstack.conf
$mysql_user = 'refstack',
$mysql_user_password,
$mysql_host = localhost,
$mysql_port = 3306,
$mysql_database = 'refstack',
) {
# Resolve a few parameters based on the install environment.
@ -34,4 +41,8 @@ class refstack::params (
# Create our install directory with a python-versioned name (because venv).
$install_api_root = "/var/lib/refstack-py${python_version}"
# Build the connection string from individual parameters
$mysql_connection_string = "mysql://${mysql_user}:${mysql_user_password}@${mysql_host}:${mysql_port}/${mysql_database}"
}

View File

@ -15,6 +15,10 @@
{
"name": "openstackci/vcsrepo",
"version_requirement": ">= 0.0.8"
},
{
"name": "puppetlabs/mysql",
"version_requirement": ">= 0.6.1"
}
]
}

View File

@ -1,4 +1,5 @@
node default {
class { 'refstack':
mysql_user_password => 'refstack',
}
}

View File

@ -20,4 +20,7 @@ if [ ! -d /etc/puppet/modules/python ]; then
fi
if [ ! -d /etc/puppet/modules/vcsrepo ]; then
puppet module install openstackci-vcsrepo --version 0.0.8
fi
if [ ! -d /etc/puppet/modules/mysql ]; then
puppet module install puppetlabs-mysql --version 0.6.1
fi