forked from crowbar/crowbar-openstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Itxaka
committed
Sep 13, 2016
1 parent
12f3b94
commit 198e5fa
Showing
25 changed files
with
2,450 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env ruby | ||
# | ||
# Copyright 2016, SUSE LINUX GmbH | ||
# | ||
# 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 File.join(File.expand_path(File.dirname(__FILE__)), "barclamp_lib") | ||
@barclamp = "sahara" | ||
@timeout = 3600 | ||
|
||
main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
DESCRIPTION | ||
=========== | ||
Chef Cookbook to install and configure sahara | ||
|
||
REQUIREMENTS | ||
============ | ||
TBD | ||
|
||
|
||
License | ||
======= | ||
Copyright:: 2016 SUSE LINUX GmbH | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2016, SUSE Linux GmbH | ||
# | ||
# 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. | ||
# | ||
|
||
default[:sahara][:debug] = false | ||
default[:sahara][:verbose] = false | ||
override[:sahara][:user] = "sahara" | ||
override[:sahara][:group] = "sahara" | ||
default[:sahara][:max_header_line] = 16384 | ||
default[:sahara][:api][:protocol] = "http" | ||
default[:sahara][:api][:bind_port] = 8386 | ||
default[:sahara][:use_syslog] = false | ||
|
||
default[:sahara][:ha][:enabled] = false | ||
# Ports to bind to when haproxy is used for the real ports | ||
default[:sahara][:ha][:ports][:api_port] = 5573 | ||
|
||
default[:sahara][:ha][:api][:ra] = if ["rhel", "suse"].include? node[:platform_family] | ||
"lsb:openstack-sahara-api" | ||
else | ||
"lsb:sahara-api" | ||
end | ||
|
||
default[:sahara][:ha][:engine][:ra] = if ["rhel", "suse"].include? node[:platform_family] | ||
"lsb:openstack-sahara-engine" | ||
else | ||
"lsb:sahara-engine" | ||
end | ||
|
||
default[:sahara][:ha][:op][:monitor][:interval] = "10s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2016, SUSE Linux GmbH | ||
# | ||
# 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. | ||
# | ||
|
||
define :sahara_service do | ||
sahara_service_name = "sahara-#{params[:name]}" | ||
ha_enabled = node[:sahara][:ha][:enabled] | ||
|
||
package "openstack-sahara-#{params[:name]}" if ["rhel", "suse"].include? node[:platform_family] | ||
|
||
service sahara_service_name do | ||
service_name "openstack-#{sahara_service_name}" | ||
supports status: true, restart: true | ||
action [:enable, :start] | ||
subscribes :restart, resources(template: "/etc/sahara/sahara.conf") | ||
provider Chef::Provider::CrowbarPacemakerService if ha_enabled | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2016 SUSE Linux GmbH | ||
# | ||
# 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. | ||
# | ||
|
||
module SaharaHelper | ||
class << self | ||
def network_settings(node) | ||
@ip ||= Chef::Recipe::Barclamp::Inventory.get_network_by_type(node, "admin").address | ||
@cluster_admin_ip ||= nil | ||
|
||
if node[:sahara][:ha][:enabled] && !@cluster_admin_ip | ||
@cluster_admin_ip = CrowbarPacemakerHelper.cluster_vip(node, "admin") | ||
end | ||
|
||
@network_settings ||= { | ||
ip: @ip, | ||
|
||
api: { | ||
bind_host: if !node[:sahara][:ha][:enabled] && node[:sahara][:api][:bind_open_address] | ||
"0.0.0.0" | ||
else | ||
@ip | ||
end, | ||
bind_port: if node[:sahara][:ha][:enabled] | ||
node[:sahara][:ha][:ports][:api_port].to_i | ||
else | ||
node[:sahara][:api][:bind_port].to_i | ||
end, | ||
ha_bind_host: node[:sahara][:api][:bind_open_address] ? "0.0.0.0" : @cluster_admin_ip, | ||
ha_bind_port: node[:sahara][:api][:bind_port].to_i | ||
} | ||
} | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright 2016, SUSE Linux GmbH | ||
# | ||
# 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. | ||
# | ||
|
||
name "sahara" | ||
maintainer "Crowbar project" | ||
maintainer_email "[email protected]" | ||
license "Apache 2.0" | ||
description "Installs/Configures sahara" | ||
long_description IO.read(File.join(File.dirname(__FILE__), "README.md")) | ||
version "0.1" | ||
|
||
depends "database" | ||
depends "keystone" | ||
depends "crowbar-openstack" | ||
depends "crowbar-pacemaker" | ||
depends "utils" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Copyright 2016 SUSE Linux GmbH | ||
# | ||
# 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. | ||
# | ||
# Cookbook Name:: sahara | ||
# Recipe:: api | ||
# | ||
|
||
keystone_settings = KeystoneHelper.keystone_settings(node, @cookbook_name) | ||
|
||
sahara_port = node[:sahara][:api][:bind_port] | ||
sahara_protocol = node[:sahara][:api][:protocol] | ||
|
||
ha_enabled = node[:sahara][:ha][:enabled] | ||
|
||
my_admin_host = CrowbarHelper.get_host_for_admin_url(node, ha_enabled) | ||
my_public_host = CrowbarHelper.get_host_for_public_url( | ||
node, node[:sahara][:api][:protocol] == "https", ha_enabled | ||
) | ||
|
||
register_auth_hash = { user: keystone_settings["admin_user"], | ||
password: keystone_settings["admin_password"], | ||
tenant: keystone_settings["admin_tenant"] } | ||
|
||
crowbar_pacemaker_sync_mark "wait-sahara_register" | ||
|
||
keystone_register "sahara api wakeup keystone" do | ||
protocol keystone_settings["protocol"] | ||
insecure keystone_settings["insecure"] | ||
host keystone_settings["internal_url_host"] | ||
port keystone_settings["admin_port"] | ||
auth register_auth_hash | ||
action :wakeup | ||
end | ||
|
||
keystone_register "register sahara user" do | ||
protocol keystone_settings["protocol"] | ||
insecure keystone_settings["insecure"] | ||
host keystone_settings["internal_url_host"] | ||
port keystone_settings["admin_port"] | ||
auth register_auth_hash | ||
user_name keystone_settings["service_user"] | ||
user_password keystone_settings["service_password"] | ||
tenant_name keystone_settings["service_tenant"] | ||
action :add_user | ||
end | ||
|
||
keystone_register "give sahara user access" do | ||
protocol keystone_settings["protocol"] | ||
insecure keystone_settings["insecure"] | ||
host keystone_settings["internal_url_host"] | ||
port keystone_settings["admin_port"] | ||
auth register_auth_hash | ||
user_name keystone_settings["service_user"] | ||
tenant_name keystone_settings["service_tenant"] | ||
role_name "admin" | ||
action :add_access | ||
end | ||
|
||
keystone_register "register sahara service" do | ||
protocol keystone_settings["protocol"] | ||
insecure keystone_settings["insecure"] | ||
host keystone_settings["internal_url_host"] | ||
port keystone_settings["admin_port"] | ||
auth register_auth_hash | ||
service_name "sahara" | ||
service_type "data-processing" | ||
service_description "Openstack Sahara - Data Processing" | ||
action :add_service | ||
end | ||
|
||
keystone_register "register sahara endpoint" do | ||
protocol keystone_settings["protocol"] | ||
insecure keystone_settings["insecure"] | ||
host keystone_settings["internal_url_host"] | ||
port keystone_settings["admin_port"] | ||
auth register_auth_hash | ||
endpoint_service "sahara" | ||
endpoint_region keystone_settings["endpoint_region"] | ||
endpoint_publicURL "#{sahara_protocol}://#{my_public_host}:#{sahara_port}/v1.1/%(tenant_id)s" | ||
endpoint_adminURL "#{sahara_protocol}://#{my_admin_host}:#{sahara_port}/v1.1/%(tenant_id)s" | ||
endpoint_internalURL "#{sahara_protocol}://#{my_admin_host}:#{sahara_port}/v1.1/%(tenant_id)s" | ||
action :add_endpoint_template | ||
end | ||
|
||
crowbar_pacemaker_sync_mark "create-sahara_register" | ||
|
||
sahara_service "api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright 2016 SUSE Linux GmbH | ||
# | ||
# 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. | ||
# | ||
|
||
package "openstack-sahara" | ||
|
||
network_settings = SaharaHelper.network_settings(node) | ||
db_settings = fetch_database_settings | ||
|
||
include_recipe "database::client" | ||
include_recipe "#{db_settings[:backend_name]}::client" | ||
include_recipe "#{db_settings[:backend_name]}::python-client" | ||
|
||
# get Database data | ||
db_password = node[:sahara][:db][:password] | ||
sql_connection = "#{db_settings[:url_scheme]}://#{node[:sahara][:db][:user]}:"\ | ||
"#{db_password}@#{db_settings[:address]}/"\ | ||
"#{node[:sahara][:db][:database]}" | ||
|
||
# cinder insecure? | ||
cinder = get_instance("roles:cinder-controller") | ||
cinder_insecure = cinder[:cinder][:ssl][:insecure] | ||
|
||
# heat insecure? | ||
heat = get_instance("roles:heat-server") | ||
heat_insecure = heat[:heat][:ssl][:insecure] | ||
|
||
# neutron insecure? | ||
neutron = get_instance("roles:neutron-server") | ||
neutron_insecure = neutron[:neutron][:ssl][:insecure] | ||
|
||
# nova insecure? | ||
nova = get_instance("roles:nova-controller") | ||
nova_insecure = nova[:nova][:ssl][:insecure] | ||
|
||
# use ceilometer? | ||
ceilometers = search_env_filtered(:node, "roles:ceilometer-server") | ||
use_ceilometer = !ceilometers.empty? | ||
|
||
template "/etc/sudoers.d/openstack-sahara" do | ||
source "sahara-rootwrap.erb" | ||
owner "root" | ||
group "root" | ||
mode "0440" | ||
end | ||
|
||
template "/etc/sahara/sahara.conf" do | ||
source "sahara.conf.erb" | ||
owner "root" | ||
group node[:sahara][:group] | ||
mode "0640" | ||
variables( | ||
bind_host: network_settings[:api][:bind_host], | ||
bind_port: network_settings[:api][:bind_port], | ||
sql_connection: sql_connection, | ||
rabbit_settings: fetch_rabbitmq_settings, | ||
keystone_settings: KeystoneHelper.keystone_settings(node, :sahara), | ||
cinder_insecure: cinder_insecure, | ||
heat_insecure: heat_insecure, | ||
neutron_insecure: neutron_insecure, | ||
nova_insecure: nova_insecure, | ||
use_ceilometer: use_ceilometer | ||
) | ||
end | ||
|
||
node.save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2016 SUSE Linux GmbH | ||
# | ||
# 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. | ||
# | ||
# Cookbook Name:: sahara | ||
# Recipe:: engine | ||
# | ||
|
||
sahara_service "engine" |
Oops, something went wrong.