initial database support

Create the manila user, database and grant permission to it.

Change-Id: I36cbbdbb75ee346d8268faa45505813675f46331
This commit is contained in:
Igor Gajsin 2016-07-25 19:11:51 +03:00
parent 6ba724d518
commit 8b53020c7a
6 changed files with 82 additions and 5 deletions

View File

@ -0,0 +1,53 @@
# Copyright 2016 Mirantis, 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.
notify {'MOUDULAR: fuel-plugin-manila/db': }
$mysql = hiera_hash('mysql', {})
$manila = hiera_hash('manila', {})
$db_host = hiera('database_vip')
$db_root_user = pick($mysql['root_user'], 'root')
$db_root_password = $mysql['root_password']
$db_user = 'manila'
$db_password = $manila['db_password']
$db_name = 'manila'
$allowed_hosts = [ 'localhost', '127.0.0.1', '%' ]
class { '::openstack::galera::client':
custom_setup_class => hiera('mysql_custom_setup_class', 'galera'),
}
class { '::osnailyfacter::mysql_access':
db_host => $db_host,
db_user => $db_root_user,
db_password => $db_root_password,
}
class { '::manila::db::mysql':
user => $db_user,
password => $db_password,
dbname => $db_name,
allowed_hosts => $allowed_hosts,
}
class mysql::config {}
include mysql::config
class mysql::server {}
include mysql::server
Class['::openstack::galera::client'] ->
Class['::osnailyfacter::mysql_access']
-> Class['::manila::db::mysql']

View File

@ -1,4 +1,4 @@
notify {'MODULAR manila/keystone': }
notify {'MODULAR fuel-plugin-manila/keystone': }
$manila = hiera_hash('manila', {})
$pass = $manila['user_password']

View File

@ -1,9 +1,11 @@
notify {'MODULAR: manila/populate_hiera': }
notify {'MODULAR: fuel-plugin-manila/populate_hiera': }
$manila = hiera_hash('manila', false)
$file = '/etc/hiera/plugins/fuel-plugin-manila.yaml'
$new_password = generate("/bin/bash", "-c", "/bin/date +%s | sha256sum | base64 | head -c 32 ; echo -n")
$db_password = generate("/bin/bash", "-c", "/bin/date +%s | sha256sum | base64 | head -c 32 ; echo -n")
if ! $manila {
populate_hiera($file, 'user_password', $new_password)
populate_hiera($file, 'db_password', $db_password)
}

@ -1 +1 @@
Subproject commit 3d8244db11cb603f89980b8fbefc5dc228f0a7d8
Subproject commit 110a0b4d02d7038ec2ed1fecc635543b42d7f0bd

View File

@ -15,6 +15,8 @@
type: puppet
groups: [primary-controller, controller]
version: 2.1.0
requires: [hiera]
required_for: [manila-keystone]
cross-depends:
- name: manila-start
cross-depended-by:
@ -28,6 +30,8 @@
type: puppet
groups: [primary-controller, controller]
version: 2.1.0
requires: [manila-hiera]
required_for: [manila-db]
cross-depends:
- name: manila-hiera
cross-depended-by:
@ -37,12 +41,30 @@
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-db
type: puppet
groups: [primary-controller]
version: 2.1.0
required_for: [manila-main]
requires: [primary-database, database, manila-hiera]
condition:
yaql_exp: >
changedAny($.mysql, $.network_metadata.vips, $.get('database_vip'))
cross-depends:
- name: /^(primary-)?database$/
cross-depended-by:
- name: deploy_end
parameters:
puppet_manifest: "puppet/manifests/db.pp"
puppet_modules: "puppet/modules:/etc/puppet/modules"
timeout: 3600
- id: manila-main
type: puppet
groups: [primary-controller, controller]
version: 2.1.0
cross-depends:
- name: manila-kestone
- name: manila-db
cross-depended-by:
- name: deploy_end
parameters:

View File

@ -3,7 +3,7 @@ name: fuel-plugin-manila
# Human-readable name for your plugin
title: Title for fuel-plugin-manila plugin
# Plugin version
version: '1.0.1'
version: '1.0.2'
# Description
description: Please describe your plugin here
# Required fuel version