Separate out Keystone endpoint registration into separate recipe

This commit is contained in:
Jay Pipes 2013-03-19 18:01:22 -04:00
parent 333ffbe1dd
commit da17ee847c
3 changed files with 5 additions and 138 deletions

View File

@ -4,14 +4,15 @@ maintainer_email "matt@opscode.com"
license "Apache 2.0"
description "The OpenStack Compute service Nova."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "2012.2.0"
version "2012.2.1"
recipe "nova::api-ec2", "Installs AWS EC2 compatible API and configures the service and endpoints in keystone"
recipe "nova::api-ec2", "Installs AWS EC2 compatible API"
recipe "nova::api-metadata", "Installs the nova metadata package"
recipe "nova::api-os-compute", "Installs OS API and configures the service and endpoints in keystone"
recipe "nova::api-os-compute", "Installs OS API"
recipe "nova::compute", "nova-compute service"
recipe "nova::db", "Configures database for use with nova"
recipe "nova::libvirt", "Installs libvirt, used by nova compute for management of the virtual machine environment"
recipe "nova::keystone_registration", "Registers the API and EC2 endpoints with Keystone"
recipe "nova::network", "Installs nova network service"
recipe "nova::nova-cert", "Installs nova-cert service"
recipe "nova::nova-common", "Builds the basic nova.conf config file with details of the rabbitmq, mysql, glance and keystone servers"

View File

@ -17,8 +17,6 @@
# limitations under the License.
#
require "uri"
class ::Chef::Recipe
include ::Openstack
end
@ -55,73 +53,8 @@ service "nova-api-ec2" do
action :enable
end
service_pass = service_password "nova"
identity_admin_endpoint = endpoint "identity-admin"
keystone_service_role = node["nova"]["keystone_service_chef_role"]
keystone = config_by_role keystone_service_role, "keystone"
ec2_admin_endpoint = endpoint "compute-ec2-admin"
ec2_public_endpoint = endpoint "compute-ec2-api"
bootstrap_token = secret "secrets", "keystone_bootstrap_token"
auth_uri = ::URI.decode identity_admin_endpoint.to_s
# Register Service Tenant
keystone_register "Register Service Tenant" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["nova"]["service_tenant_name"]
tenant_description "Service Tenant"
action :create_tenant
end
# Register Service User
keystone_register "Register Service User" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["nova"]["service_tenant_name"]
user_name node["nova"]["service_user"]
user_pass service_pass
action :create_user
end
# Grant Admin role to Service User for Service Tenant
keystone_register "Grant 'admin' Role to Service User for Service Tenant" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["nova"]["service_tenant_name"]
user_name node["nova"]["service_user"]
role_name node["nova"]["service_role"]
action :grant_role
end
# Register EC2 Service
keystone_register "Register EC2 Service" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_name "ec2"
service_type "ec2"
service_description "EC2 Compatibility Layer"
action :create_service
end
# Register EC2 Endpoint
keystone_register "Register Compute Endpoint" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_type "ec2"
endpoint_region node["nova"]["region"]
endpoint_adminurl ::URI.decode ec2_admin_endpoint.to_s
endpoint_internalurl ::URI.decode ec2_public_endpoint.to_s
endpoint_publicurl ::URI.decode ec2_public_endpoint.to_s
action :create_endpoint
end
service_pass = service_password "nova"
template "/etc/nova/api-paste.ini" do
source "api-paste.ini.erb"

View File

@ -17,8 +17,6 @@
# limitations under the License.
#
require "uri"
class ::Chef::Recipe
include ::Openstack
end
@ -61,74 +59,9 @@ service "nova-api-os-compute" do
action :enable
end
keystone_service_role = node["nova"]["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
service_pass = service_password "nova"
nova_api_endpoint = endpoint "compute-api"
# Register Service Tenant
keystone_register "Register Service Tenant" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["nova"]["service_tenant_name"]
tenant_description "Service Tenant"
action :create_tenant
end
# Register Service User
keystone_register "Register Service User" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["nova"]["service_tenant_name"]
user_name node["nova"]["service_user"]
user_pass service_pass
user_enabled "true" # Not required as this is the default
action :create_user
end
## Grant Admin role to Service User for Service Tenant ##
keystone_register "Grant 'admin' Role to Service User for Service Tenant" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node["nova"]["service_tenant_name"]
user_name node["nova"]["service_user"]
role_name node["nova"]["service_role"]
action :grant_role
end
# Register Compute Service
keystone_register "Register Compute Service" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_name "nova"
service_type "compute"
service_description "Nova Compute Service"
action :create_service
end
# Register Compute Endpoing
keystone_register "Register Compute Endpoint" do
auth_uri auth_uri
bootstrap_token bootstrap_token
service_type "compute"
endpoint_region node["nova"]["region"]
endpoint_adminurl ::URI.decode nova_api_endpoint.to_s
endpoint_internalurl ::URI.decode nova_api_endpoint.to_s
endpoint_publicurl ::URI.decode nova_api_endpoint.to_s
action :create_endpoint
end
template "/etc/nova/api-paste.ini" do
source "api-paste.ini.erb"
owner node["nova"]["user"]