Separate out Keystone endpoint registration into separate recipe

This commit is contained in:
Jay Pipes 2013-03-19 18:24:18 -04:00
parent 1cff2ee1bc
commit b807516f83
3 changed files with 80 additions and 57 deletions

View File

@ -4,10 +4,11 @@ maintainer_email "jaypipes@gmail.com"
license "Apache 2.0"
description "The OpenStack Advanced Volume Management service Cinder."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "2012.2.0"
version "2012.2.1"
recipe "cinder::api", "Installs the cinder-api, sets up the cinder database, and cinder service/user/endpoints in keystone"
recipe "cinder::db", "Creates the Cinder database"
recipe "cinder::keystone_registration", "Registers cinder service/user/endpoints in keystone"
recipe "cinder::scheduler", "Installs the cinder-scheduler service"
recipe "cinder::volume", "Installs the cinder-volume service and sets up the iscsi helper"

View File

@ -18,8 +18,6 @@
# limitations under the License.
#
require "uri"
class ::Chef::Recipe
include ::Openstack
end
@ -64,14 +62,7 @@ glance_api_role = node["cinder"]["glance_api_chef_role"]
glance = config_by_role glance_api_role, "glance"
glance_api_endpoint = endpoint "image-api"
keystone_service_role = node["cinder"]["keystone_service_chef_role"]
keystone = config_by_role keystone_service_role, "keystone"
identity_admin_endpoint = endpoint "identity-admin"
bootstrap_token = secret "secrets", "keystone_bootstrap_token"
auth_uri = ::URI.decode identity_admin_endpoint.to_s
cinder_api_endpoint = endpoint "volume-api"
service_pass = service_password "cinder"
template "/etc/cinder/cinder.conf" do
@ -107,50 +98,3 @@ template "/etc/cinder/api-paste.ini" do
notifies :restart, "service[cinder-api]", :immediately
end
keystone_register "Register Cinder Volume Service" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_name "cinder"
service_type "volume"
service_description "Cinder Volume Service"
endpoint_region node["cinder"]["region"]
endpoint_adminurl ::URI.decode cinder_api_endpoint.to_s
endpoint_internalurl ::URI.decode cinder_api_endpoint.to_s
endpoint_publicurl ::URI.decode cinder_api_endpoint.to_s
action :create_service
end
keystone_register "Register Cinder Volume Endpoint" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_name "cinder"
service_type "volume"
service_description "Cinder Volume Service"
endpoint_region node["cinder"]["region"]
endpoint_adminurl ::URI.decode cinder_api_endpoint.to_s
endpoint_internalurl ::URI.decode cinder_api_endpoint.to_s
endpoint_publicurl ::URI.decode cinder_api_endpoint.to_s
action :create_endpoint
end
keystone_register "Register Cinder Service User" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["cinder"]["service_tenant_name"]
user_name node["cinder"]["service_user"]
user_pass service_pass
user_enabled "true" # Not required as this is the default
action :create_user
end
keystone_register "Grant service Role to Cinder Service User for Cinder Service Tenant" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["cinder"]["service_tenant_name"]
user_name node["cinder"]["service_user"]
role_name node["cinder"]["service_role"]
action :grant_role
end

View File

@ -0,0 +1,78 @@
#
# Cookbook Name:: cinder
# Recipe:: api
#
# Copyright 2012, Rackspace US, Inc.
# Copyright 2012, AT&T, 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.
#
require "uri"
class ::Chef::Recipe
include ::Openstack
end
identity_admin_endpoint = endpoint "identity-admin"
bootstrap_token = secret "secrets", "keystone_bootstrap_token"
auth_uri = ::URI.decode identity_admin_endpoint.to_s
cinder_api_endpoint = endpoint "volume-api"
service_pass = service_password "cinder"
keystone_register "Register Cinder Volume Service" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_name "cinder"
service_type "volume"
service_description "Cinder Volume Service"
endpoint_region node["cinder"]["region"]
endpoint_adminurl ::URI.decode cinder_api_endpoint.to_s
endpoint_internalurl ::URI.decode cinder_api_endpoint.to_s
endpoint_publicurl ::URI.decode cinder_api_endpoint.to_s
action :create_service
end
keystone_register "Register Cinder Volume Endpoint" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_name "cinder"
service_type "volume"
service_description "Cinder Volume Service"
endpoint_region node["cinder"]["region"]
endpoint_adminurl ::URI.decode cinder_api_endpoint.to_s
endpoint_internalurl ::URI.decode cinder_api_endpoint.to_s
endpoint_publicurl ::URI.decode cinder_api_endpoint.to_s
action :create_endpoint
end
keystone_register "Register Cinder Service User" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["cinder"]["service_tenant_name"]
user_name node["cinder"]["service_user"]
user_pass service_pass
user_enabled "true" # Not required as this is the default
action :create_user
end
keystone_register "Grant service Role to Cinder Service User for Cinder Service Tenant" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["cinder"]["service_tenant_name"]
user_name node["cinder"]["service_user"]
role_name node["cinder"]["service_role"]
action :grant_role
end