Moved database table, user, grants creation
This cookbook should handle the creation of tables, users, grants for use with OpenStack. Once this is merged, will remove the db recipe from each cookbook. Change-Id: I309c4d0fedc8c78f779dbd17b265bfa7e78ffd89
This commit is contained in:
parent
6e0df1d809
commit
8e76788b4c
12
Berksfile
12
Berksfile
|
@ -1,4 +1,16 @@
|
|||
metadata
|
||||
|
||||
cookbook "openstack-block-storage",
|
||||
git: "git://github.com/stackforge/cookbook-openstack-block-storage.git"
|
||||
cookbook "openstack-common",
|
||||
git: "git://github.com/stackforge/cookbook-openstack-common.git"
|
||||
cookbook "openstack-compute",
|
||||
git: "git://github.com/stackforge/cookbook-openstack-compute.git"
|
||||
cookbook "openstack-dashboard",
|
||||
git: "git://github.com/stackforge/cookbook-openstack-dashboard.git"
|
||||
cookbook "openstack-identity",
|
||||
git: "git://github.com/stackforge/cookbook-openstack-identity.git"
|
||||
cookbook "openstack-image",
|
||||
git: "git://github.com/stackforge/cookbook-openstack-image.git"
|
||||
cookbook "openstack-network",
|
||||
git: "git://github.com/stackforge/cookbook-openstack-network.git"
|
||||
|
|
|
@ -1,14 +1,44 @@
|
|||
{
|
||||
"sha": "f4f9d20dae74eaf72a8d7141ba2932f079adc5c6",
|
||||
"sha": "04be0802cd18a9a6df36ec6bcf0129dcc601cfab",
|
||||
"sources": {
|
||||
"openstack-ops-database": {
|
||||
"path": "."
|
||||
},
|
||||
"openstack-block-storage": {
|
||||
"locked_version": "7.0.0",
|
||||
"git": "git://github.com/stackforge/cookbook-openstack-block-storage.git",
|
||||
"ref": "2f7915360a7d69d58d5dfe6a51401d5ff7ade5e1"
|
||||
},
|
||||
"openstack-common": {
|
||||
"locked_version": "0.3.0",
|
||||
"git": "git://github.com/stackforge/cookbook-openstack-common.git",
|
||||
"ref": "0c771cfab3147489e7dffcf9b9b067f2aa9d0f8b"
|
||||
},
|
||||
"openstack-compute": {
|
||||
"locked_version": "7.0.0",
|
||||
"git": "git://github.com/stackforge/cookbook-openstack-compute.git",
|
||||
"ref": "89201c6ff17e77b3fd4ccfb8ac98ecd8cdfc3921"
|
||||
},
|
||||
"openstack-dashboard": {
|
||||
"locked_version": "7.0.0",
|
||||
"git": "git://github.com/stackforge/cookbook-openstack-dashboard.git",
|
||||
"ref": "51d540a734b63ad517e70d2ae604ed0b63d63bc0"
|
||||
},
|
||||
"openstack-identity": {
|
||||
"locked_version": "7.0.0",
|
||||
"git": "git://github.com/stackforge/cookbook-openstack-identity.git",
|
||||
"ref": "e07ccdc5cdf6221967f2cffc748dabe1caf46f45"
|
||||
},
|
||||
"openstack-image": {
|
||||
"locked_version": "7.0.0",
|
||||
"git": "git://github.com/stackforge/cookbook-openstack-image.git",
|
||||
"ref": "9dec548bec14524fbc6db6ceb33fa32d7db71ccc"
|
||||
},
|
||||
"openstack-network": {
|
||||
"locked_version": "7.0.0",
|
||||
"git": "git://github.com/stackforge/cookbook-openstack-network.git",
|
||||
"ref": "335b045e68eff2beea4fc73eeebb6937652e7ac7"
|
||||
},
|
||||
"database": {
|
||||
"locked_version": "1.4.0"
|
||||
},
|
||||
|
@ -32,6 +62,33 @@
|
|||
},
|
||||
"xfs": {
|
||||
"locked_version": "1.1.0"
|
||||
},
|
||||
"openssh": {
|
||||
"locked_version": "1.2.0"
|
||||
},
|
||||
"iptables": {
|
||||
"locked_version": "0.12.0"
|
||||
},
|
||||
"rabbitmq": {
|
||||
"locked_version": "2.1.0"
|
||||
},
|
||||
"erlang": {
|
||||
"locked_version": "1.3.0"
|
||||
},
|
||||
"yum": {
|
||||
"locked_version": "2.2.2"
|
||||
},
|
||||
"selinux": {
|
||||
"locked_version": "0.5.6"
|
||||
},
|
||||
"apache2": {
|
||||
"locked_version": "1.6.6"
|
||||
},
|
||||
"sysctl": {
|
||||
"locked_version": "0.3.3"
|
||||
},
|
||||
"python": {
|
||||
"locked_version": "1.3.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
README.md
12
README.md
|
@ -21,7 +21,11 @@ The following cookbooks are dependencies:
|
|||
|
||||
# Usage #
|
||||
|
||||
The usage of this cookbook is optional, you may choose to set up your own databases without using this cookbook. If you choose to do so, you will need to provide all of the attributes listed under the [Attributes](#attributes) and create the schema specified by the `openstack-*-db` recipes.
|
||||
The usage of this cookbook is optional, you may choose to set up your own databases without using this cookbook. If you choose to do so, you will need to do the following:
|
||||
|
||||
* create the schema specified by the `openstack-db` recipe.
|
||||
* create and upload encrypted data bags into your chef environment, as
|
||||
specified by `#db_password` in the `openstack-db` recipe.
|
||||
|
||||
# Resources/Providers #
|
||||
|
||||
|
@ -49,10 +53,12 @@ None
|
|||
|
||||
- configures the mysql server for OpenStack
|
||||
|
||||
## openstack-db ##
|
||||
|
||||
- creates necessary tables, users, and grants for OpenStack
|
||||
|
||||
# Attributes #
|
||||
|
||||
* `openstack["database"]["server_role"]` - which role should other nodes search on to find the database service, defaults to 'os-ops-database'
|
||||
* `openstack["database"]["service_type"]` - which service to use, defaults to 'mysql'
|
||||
* `openstack["database"]["bind_interface"]` - bind to interfaces IPv4 address
|
||||
* `openstack["database"]["platform"]["mysql_python_packages"]` - platform-specific mysql python packages to install
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@
|
|||
#
|
||||
|
||||
default["openstack"]["database"]["server_role"] = "os-ops-database"
|
||||
default["openstack"]["database"]["service_type"] = "mysql"
|
||||
default["openstack"]["database"]["bind_interface"] = "lo"
|
||||
# TODO(retr0h): Delete when these attributes are merged into openstack-common
|
||||
default["openstack"]["database"]["service_type"] = "mysql"
|
||||
|
||||
# Platform defaults
|
||||
case platform
|
||||
|
|
|
@ -9,6 +9,7 @@ recipe "client", "Installs client packages for the database used by the deployme
|
|||
recipe "server", "Installs and configures server packages for the database used by the deployment."
|
||||
recipe "mysql-client", "Installs MySQL client packages."
|
||||
recipe "mysql-server", "Installs and configured MySQL server packages."
|
||||
recipe "openstack-db", "Creates necessary tables, users, and grants for OpenStack."
|
||||
|
||||
%w{ fedora ubuntu redhat centos }.each do |os|
|
||||
supports os
|
||||
|
@ -16,5 +17,11 @@ end
|
|||
|
||||
depends "database", ">= 1.4"
|
||||
depends "mysql", ">= 3.0.0"
|
||||
depends "openstack-block-storage"
|
||||
depends "openstack-common", "~> 0.3.0"
|
||||
depends "openstack-compute"
|
||||
depends "openstack-dashboard"
|
||||
depends "openstack-identity"
|
||||
depends "openstack-image"
|
||||
depends "openstack-network"
|
||||
depends "postgresql", ">= 3.0.0"
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
#
|
||||
# Cookbook Name:: openstack-ops-database
|
||||
# Recipe:: openstack-db
|
||||
#
|
||||
# Copyright 2012-2013, AT&T Services, 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 ::Chef::Recipe
|
||||
include ::Openstack
|
||||
end
|
||||
|
||||
db_create_with_user(
|
||||
"compute",
|
||||
node["openstack"]["compute"]["db"]["username"],
|
||||
db_password("nova")
|
||||
)
|
||||
|
||||
db_create_with_user(
|
||||
"dashboard",
|
||||
node["openstack"]["dashboard"]["db"]["username"],
|
||||
db_password("horizon")
|
||||
)
|
||||
|
||||
db_create_with_user(
|
||||
"identity",
|
||||
node["openstack"]["identity"]["db"]["username"],
|
||||
db_password("keystone")
|
||||
)
|
||||
|
||||
db_create_with_user(
|
||||
"image",
|
||||
node["openstack"]["image"]["db"]["username"],
|
||||
db_password("glance")
|
||||
)
|
||||
|
||||
db_create_with_user(
|
||||
"metering",
|
||||
node["openstack"]["compute"]["ceilometer"]["db"]["username"],
|
||||
db_password("ceilometer")
|
||||
)
|
||||
|
||||
db_create_with_user(
|
||||
"network",
|
||||
node["openstack"]["network"]["db"]["username"],
|
||||
db_password("quantum")
|
||||
)
|
||||
|
||||
db_create_with_user(
|
||||
"volume",
|
||||
node["openstack"]["block-storage"]["db"]["username"],
|
||||
db_password("cinder")
|
||||
)
|
|
@ -0,0 +1,59 @@
|
|||
require_relative "spec_helper"
|
||||
|
||||
describe "openstack-ops-database::openstack-db" do
|
||||
before do
|
||||
::Chef::Recipe.any_instance.stub(:db_create_with_user)
|
||||
::Chef::Recipe.any_instance.stub(:db_password).
|
||||
and_return("test-pass")
|
||||
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
|
||||
end
|
||||
|
||||
it "creates nova database and user" do
|
||||
::Chef::Recipe.any_instance.should_receive(:db_create_with_user).
|
||||
with "dashboard", "dash", "test-pass"
|
||||
|
||||
@chef_run.converge "openstack-ops-database::openstack-db"
|
||||
end
|
||||
|
||||
it "creates dashboard database and user" do
|
||||
::Chef::Recipe.any_instance.should_receive(:db_create_with_user).
|
||||
with "dashboard", "dash", "test-pass"
|
||||
|
||||
@chef_run.converge "openstack-ops-database::openstack-db"
|
||||
end
|
||||
|
||||
it "creates identity database and user" do
|
||||
::Chef::Recipe.any_instance.should_receive(:db_create_with_user).
|
||||
with "identity", "keystone", "test-pass"
|
||||
|
||||
@chef_run.converge "openstack-ops-database::openstack-db"
|
||||
end
|
||||
|
||||
it "creates image database and user" do
|
||||
::Chef::Recipe.any_instance.should_receive(:db_create_with_user).
|
||||
with "image", "glance", "test-pass"
|
||||
|
||||
@chef_run.converge "openstack-ops-database::openstack-db"
|
||||
end
|
||||
|
||||
it "creates metering database and user" do
|
||||
::Chef::Recipe.any_instance.should_receive(:db_create_with_user).
|
||||
with "metering", "ceilometer", "test-pass"
|
||||
|
||||
@chef_run.converge "openstack-ops-database::openstack-db"
|
||||
end
|
||||
|
||||
it "creates network database and user" do
|
||||
::Chef::Recipe.any_instance.should_receive(:db_create_with_user).
|
||||
with "network", "quantum", "test-pass"
|
||||
|
||||
@chef_run.converge "openstack-ops-database::openstack-db"
|
||||
end
|
||||
|
||||
it "creates volume database and user" do
|
||||
::Chef::Recipe.any_instance.should_receive(:db_create_with_user).
|
||||
with "volume", "cinder", "test-pass"
|
||||
|
||||
@chef_run.converge "openstack-ops-database::openstack-db"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue