Make chef-roles configurable
Change the chef roles hard coded in the recipes and templates into attributes which can be overriden by the cookbook end-user. Change-Id: I1ed6480b702f690a4b5967034a5f6b5fc5ce4252
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
This file is used to list changes made in each version of cookbook-openstack-object-storage.
|
||||
|
||||
## 7.0.4:
|
||||
* Allow roles used in searches to be defined by cookbook user
|
||||
|
||||
## 7.0.3:
|
||||
* Bugfix the swift-ring-builder output scanner
|
||||
|
||||
|
||||
@@ -25,6 +25,17 @@ default["swift"]["release"] = "folsom"
|
||||
# }
|
||||
default["swift"]["swift_secret_databag_name"] = nil
|
||||
|
||||
#--------------------
|
||||
# roles
|
||||
#--------------------
|
||||
|
||||
default["swift"]["setup_chef_role"] = "swift-setup"
|
||||
default["swift"]["management_server_chef_role"] = "swift-management-server"
|
||||
default["swift"]["proxy_server_chef_role"] = "swift-proxy-server"
|
||||
default["swift"]["object_server_chef_role"] = "swift-object-server"
|
||||
default["swift"]["account_server_chef_role"] = "swift-account-server"
|
||||
default["swift"]["container_server_chef_role"] = "swift-container-server"
|
||||
|
||||
#--------------------
|
||||
# authentication
|
||||
#--------------------
|
||||
|
||||
@@ -3,7 +3,7 @@ maintainer "ATT, Inc."
|
||||
license "Apache 2.0"
|
||||
description "Installs and configures Openstack Swift"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "7.0.3"
|
||||
version "7.0.4"
|
||||
recipe "openstack-object-storage::setup", "Does initial setup of a swift cluster"
|
||||
recipe "openstack-object-storage::account-server", "Installs the swift account server"
|
||||
recipe "openstack-object-storage::object-server", "Installs the swift object server"
|
||||
|
||||
@@ -62,7 +62,8 @@ def generate_script
|
||||
|
||||
# figure out what's present in the cluster
|
||||
disk_data[which] = {}
|
||||
disk_state,_,_ = Chef::Search::Query.new.search(:node,"chef_environment:#{node.chef_environment} AND roles:swift-#{which}-server")
|
||||
role = node["swift"]["#{which}_server_chef_role"]
|
||||
disk_state,_,_ = Chef::Search::Query.new.search(:node,"chef_environment:#{node.chef_environment} AND roles:#{role}")
|
||||
|
||||
# for a running track of available disks
|
||||
disk_data[:available] ||= {}
|
||||
|
||||
@@ -26,7 +26,8 @@ end
|
||||
if node.run_list.expand(node.chef_environment).recipes.include?("openstack-object-storage::setup")
|
||||
Chef::Log.info("I ran the openstack-object-storage::setup so I will use my own swift passwords")
|
||||
else
|
||||
setup = search(:node, "chef_environment:#{node.chef_environment} AND roles:swift-setup")
|
||||
setup_role = node["swift"]["setup_chef_role"]
|
||||
setup = search(:node, "chef_environment:#{node.chef_environment} AND roles:#{setup_role}")
|
||||
if setup.length == 0
|
||||
Chef::Application.fatal! "You must have run the openstack-object-storage::setup recipe (on this or another node) before running the swift::proxy recipe on this node"
|
||||
elsif setup.length == 1
|
||||
@@ -84,7 +85,8 @@ if Chef::Config[:solo]
|
||||
memcache_servers = [ "127.0.0.1:11211" ]
|
||||
else
|
||||
memcache_servers = []
|
||||
proxy_nodes = search(:node, "chef_environment:#{node.chef_environment} AND roles:swift-proxy-server")
|
||||
proxy_role = node["swift"]["proxy_server_chef_role"]
|
||||
proxy_nodes = search(:node, "chef_environment:#{node.chef_environment} AND roles:#{proxy_role}")
|
||||
proxy_nodes.each do |proxy|
|
||||
proxy_ip = locate_ip_in_cidr(node["swift"]["network"]["proxy-cidr"], proxy)
|
||||
next if not proxy_ip # skip nil ips so we dont break the config
|
||||
|
||||
@@ -22,7 +22,8 @@ include_recipe "openstack-object-storage::common"
|
||||
if Chef::Config[:solo]
|
||||
Chef::Application.fatal! "This recipe uses search. Chef Solo does not support search."
|
||||
else
|
||||
setup_role_count = search(:node, "chef_environment:#{node.chef_environment} AND roles:swift-setup").length
|
||||
setup_role = node["swift"]["setup_chef_role"]
|
||||
setup_role_count = search(:node, "chef_environment:#{node.chef_environment} AND roles:#{setup_role}").length
|
||||
if setup_role_count > 1
|
||||
Chef::Application.fatal! "You can only have one node with the swift-setup role"
|
||||
end
|
||||
|
||||
@@ -16,7 +16,7 @@ end
|
||||
#
|
||||
# Cluster info:
|
||||
# Auth mode: <%= node[:swift][:authmode] %>
|
||||
# Management server: <%= node[:roles].include?("swift-management-server") %>
|
||||
# Management server: <%= node[:roles].include?(node[:swift][:management_server_chef_role]) %>
|
||||
# Account management enabled: <%= account_management %>
|
||||
# Auth pipeline: <%= pipeline %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user