From ef4a3055abee950950c2aac127854eb9e83f2793 Mon Sep 17 00:00:00 2001 From: Mustapha Lansana Date: Wed, 30 Jul 2014 20:21:11 -0400 Subject: deploychef: result of adapting deploychef to openstackchef class The functionality the following files provide are now implemented in openstackchef class, they are no longer needed in the deploychef package. Signed-off-by: Mustapha Lansana --- .../deploychef/files/chefsolo_default_attribute.rb | 76 ------ .../deploychef/files/chefsolo_default_recipe.rb | 264 -------------------- .../files/conf-templates/ceilometer-template.inc | 19 -- .../files/conf-templates/ceph-template.inc | 26 -- .../files/conf-templates/cinder-template.inc | 21 -- .../deploychef/files/conf-templates/constants.inc | 23 -- .../files/conf-templates/glance-template.inc | 16 -- .../files/conf-templates/heat-template.inc | 15 -- .../files/conf-templates/hosts-template.inc | 10 - .../files/conf-templates/keystone-template.inc | 24 -- .../files/conf-templates/neutron-template.inc | 24 -- .../files/conf-templates/nova-template.inc | 47 ---- .../files/conf-templates/postgresql-template.inc | 12 - .../files/conf-templates/swift-template.inc | 37 --- .../deploychef/files/generate-templates | 274 --------------------- 15 files changed, 888 deletions(-) delete mode 100644 meta-openstack/recipes-support/deploychef/files/chefsolo_default_attribute.rb delete mode 100644 meta-openstack/recipes-support/deploychef/files/chefsolo_default_recipe.rb delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/ceilometer-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/ceph-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/cinder-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/constants.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/glance-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/heat-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/hosts-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/keystone-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/neutron-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/nova-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/postgresql-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/conf-templates/swift-template.inc delete mode 100644 meta-openstack/recipes-support/deploychef/files/generate-templates (limited to 'meta-openstack/recipes-support/deploychef/files') diff --git a/meta-openstack/recipes-support/deploychef/files/chefsolo_default_attribute.rb b/meta-openstack/recipes-support/deploychef/files/chefsolo_default_attribute.rb deleted file mode 100644 index caf5af2..0000000 --- a/meta-openstack/recipes-support/deploychef/files/chefsolo_default_attribute.rb +++ /dev/null @@ -1,76 +0,0 @@ -# -# Copyright (c) 2014 Wind River Systems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# -#These are the default values that chef-solo uses -#to convert our template files into the respective -#configuration and script files we want it to bake. -#Note though that Some of which are overwritten in the recipe file(s) - -default["CHEFROOT_DIR"] ="%DEPLOYCHEF_ROOT_DIR%/" -default["TEMPLATE_DIR"] ="#{node[:CHEFROOT_DIR]}cookbooks/openstack/templates/default/*" -default["ETC_DIR"]= "%SYSCONFDIR%/" -default["POSTINSTS_DIR"] ="#{node[:ETC_DIR]}%POSTINSTS_DIR%/" -default["NOVA_CONF_DIR"]="#{node[:ETC_DIR]}nova/" -default["SWIFT_CONF_DIR"]="#{node[:ETC_DIR]}swift/" -default["CEILOMETER_CONF_DIR"]="#{node[:ETC_DIR]}ceilometer/" -default["NEUTRON_CONF_DIR"]= "#{node[:ETC_DIR]}neutron/" -default["NEUTRON_CORE_PLUGIN"]= "neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2" -default["OPENVSWITCH_CONF_DIR"]= "#{node[:NEUTRON_CONF_DIR]}plugins/openvswitch/" -default["LINUXBRIDGE_CONF_DIR"]= "#{node[:NEUTRON_CONF_DIR]}plugins/linuxbridge/" -default["KEYSTONE_CONF_DIR"]= "#{node[:ETC_DIR]}keystone/" -default["CINDER_CONF_DIR"]= "#{node[:ETC_DIR]}cinder/" -default["GLANCE_CONF_DIR"]= "#{node[:ETC_DIR]}glance/" -default["CEPH_CONF_DIR"]= "#{node[:ETC_DIR]}ceph/" -default["DB_DATADIR"]= "#{node[:ETC_DIR]}postgresql/" -default["HEAT_CONF_DIR"]= "#{node[:ETC_DIR]}heat/" - -default["INITD_DIR"]= "#{node[:ETC_DIR]}init.d/" -default["CONTROLLER_DAEMON"]= "#{node[:INITD_DIR]}nova-api" -default["COMPUTE_DAEMON"]= "#{node[:INITD_DIR]}nova-compute" -default["NODE_TYPE"]="compute" -default["NODE_TYPES"]="compute controller allinone" -default["POSTINSTS_SCRIPT"] = "run-postinsts" -default["PREINSTS_SCRIPT"] = "service-shutdown" -default["AUTH_PROTOCOL"] = "http" -default["PRIVATE_IP"] = "127.0.0.1" - -default["CONTROLLER_IP"] = "%CONTROLLER_IP%" -default["CONTROLLER_HOST"] = "%CONTROLLER_HOST%" -default["COMPUTE_IP"] = "%COMPUTE_IP%" -default["COMPUTE_HOST"] = "%COMPUTE_HOST%" -default["ADMIN_PASSWORD"] = "%ADMIN_PASSWORD%" -default["SERVICE_PASSWORD"] = "%SERVICE_PASSWORD%" -default["SERVICE_TENANT_NAME"] ="%SERVICE_TENANT_NAME%" -default["SERVICE_USER"] ="%SERVICE_USER%" -default["SERVICE_TOKEN"] ="%SERVICE_TOKEN%" -default["DEMO_USER"] ="%DEMO_USER%" -default["DEMO_PASSWORD"] ="%DEMO_PASSWORD%" -default["OS_TENANT_NAME"] ="%OS_TENANT_NAME%" -default["OS_USERNAME"] ="%OS_USERNAME%" -default["OS_PASSWORD"] ="%OS_PASSWORD%" -default["DB_USER"] ="%DB_USER%" -default["DB_PASSWORD"] ="%DB_PASSWORD%" -default["PUBLIC_IP"] ="#{node[:CONTROLLER_IP]}" -default["HOST_NAME"]="#{node[:CONTROLLER_HOSTS]}" -default["PUBLIC_DOMAIN"] ="#{node[:CONTROLLER_IP]}/24" - - diff --git a/meta-openstack/recipes-support/deploychef/files/chefsolo_default_recipe.rb b/meta-openstack/recipes-support/deploychef/files/chefsolo_default_recipe.rb deleted file mode 100644 index 3c83b23..0000000 --- a/meta-openstack/recipes-support/deploychef/files/chefsolo_default_recipe.rb +++ /dev/null @@ -1,264 +0,0 @@ -# default.rb -# -# Copyright (c) 2014 Wind River Systems, Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -# This is our main recipe that chef-solo bakes to configure our openstack deployment -domain = node['hostname'] -domain += " " + node['platform'] -domain += " " + node['platform_version'] -domain += " " + node['ipaddress'] -log domain do - level:info -end - -#This function enables us to over-ride the hostname and ipaddress -#attributes based on the type of node installation -#we are running on. -def update_node_info() - if File.executable?(node[:CONTROLLER_DAEMON]) and \ - File.executable?(node[:COMPUTE_DAEMON]) - #All in one installation - if node[:ipaddress].length - node.default["CONTROLLER_IP"]=node.default["COMPUTE_IP"]=node[:ipaddress] - end - if node[:hostname].length - node.default["CONTROLLER_HOST"]=node.default["COMPUTE_HOST"]=node[:hostname] - end - node.default["NODE_TYPE"] ="allinone" - elsif File.executable?(node[:CONTROLLER_DAEMON]) - if node[:ipaddress].length - node.default["CONTROLLER_IP"]=node[:ipaddress] - end - if node[:hostname].length - node.default["CONTROLLER_HOST"]=node[:hostname] - end - node.default["NODE_TYPE"] ="controller" - else - if node[:ipaddress].length - node.default["COMPUTE_IP"]=node[:ipaddress] - end - if node[:hostname].length - node.default["COMPUTE_HOST"]=node[:hostname] - end - node.default["NODE_TYPE"] ="compute" - end - - node.default["PUBLIC_IP"]="#{node[:CONTROLLER_IP]}" - node.default["HOST_NAME"]="#{node[:CONTROLLER_HOST]}" - node.default["PUBLIC_DOMAIN"]="#{node[:CONTROLLER_IP]}/24" -end -#This fucntion loops through all the files in the templates -#directory and create configuration or scripts files from the -#templates using the sets of defined attributes -def create_files_from_templates() - #Make it easier to move from development environment to target - output_dir = node[:POSTINSTS_DIR] - template_dir = node[:TEMPLATE_DIR] - #See if output directory exist if not create one - if not File.directory?(output_dir) - execute "Create #{output_dir} directory" do - command "mkdir -p #{output_dir}" - end - end - #Get the list of all template files - files = Dir.glob(template_dir) - #To ensure that the files are executed in increasing order - files = files.sort - for file in files do - #Exclude references to current and parent directory in search - next if File.directory?(file) or file == '.' or file == '..' - script_file = output_dir + File.basename(file) - script_file.gsub!(".erb","") - if File.file?(script_file) - execute "Delete file #{script_file} if present" do - command "rm -rf #{script_file}" - end - end - template script_file do - source File.basename(file) - mode 0755 - owner node[:user] - group node[:user] - end - end -end -#This function moves the generated configuration files for -#the respective modules to the specified module configuration directory -#Overwriting the current configuration file in the process -def replace_config_files(files, configDir, makeNoneExec=true) - #!files.strip - #!configDir.strip - if files and configDir - if not File.directory?(configDir) - execute "Create #{configDir}" do - command "mkdir -p #{configDir}" - end - end - if files.strip.include?(" ") - file_names = files.split - file_names.each do | fileName | - fileName=fileName.strip - if File.file?("#{node[:POSTINSTS_DIR]}#{fileName}") - execute "Move #{fileName} to #{configDir} " do - command "mv #{node[:POSTINSTS_DIR]}#{fileName} #{configDir}#{fileName}" - end - if makeNoneExec - execute "Remove execution mode on #{fileName}" do - command "chmod 0644 #{configDir}#{fileName}" - end - end - end - end - else - #There is only one file in the list - files=files.strip - if File.file?("#{node[:POSTINSTS_DIR]}#{files}") - execute "Move #{files} to #{configDir} " do - command "mv #{node[:POSTINSTS_DIR]}#{files} #{configDir}#{files}" - end - if makeNoneExec - execute "Remove execution mode on #{files}" do - command "chmod 0644 #{configDir}#{files}" - end - end - end - end - end -end - -#Update hostname and ipaddress to be written to configuration files -update_node_info - -#Generate scripts and cofiguration files -create_files_from_templates - -#Move the configuration files to /etc/nova directory -#and make remove execution modifier from the files -novaConfigFiles="nova.conf openrc api-paste.ini deploy.conf" -replace_config_files(novaConfigFiles,"#{node[:NOVA_CONF_DIR]}") -#Move the configuration files to /etc/swift directory -#and remove execution modifier from the files -swiftConfigFiles="test.conf dispersion.conf proxy-server.conf" -if node[:NODE_TYPE] == "compute" - files = swiftConfigFiles.split - files.each do | fileName | - fileName=fileName.strip - fileName ="#{node[:POSTINSTS_DIR]}#{fileName}" - if File.file?(fileName) - execute "Remove file #{fileName}" do - command "rm #{node[:POSTINSTS_DIR]}#{fileName}" - end - end - end -else - replace_config_files(swiftConfigFiles,"#{node[:SWIFT_CONF_DIR]}") -end -#Move the configuration files to /etc/neutron directory -#and remove execution modifier from the files -configFiles="neutron.conf" -replace_config_files(configFiles,"#{node[:NEUTRON_CONF_DIR]}") -configFiles="linuxbridge_conf.ini" -replace_config_files(configFiles,"#{node[:LINUXBRIDGE_CONF_DIR]}") -configFiles="ovs_neutron_plugin.ini" -replace_config_files(configFiles,"#{node[:OPENVSWITCH_CONF_DIR]}") - -configFiles="ceilometer.conf" -replace_config_files(configFiles,"#{node[:CEILOMETER_CONF_DIR]}") - -configFiles="glance-api.conf glance-cache.conf glance-registry.conf" -if node[:NODE_TYPE] == "compute" - files = configFiles.split - files.each do | fileName | - if File.file?("#{node[:POSTINSTS_DIR]}#{fileName}") - execute "Remove file #{fileName}" do - command "rm #{node[:POSTINSTS_DIR]}#{fileName}" - end - end - end -else - replace_config_files(configFiles,"#{node[:GLANCE_CONF_DIR]}") -end - -#Move the postgresql init script and make them executable -configFiles="postgresql-init" -replace_config_files(configFiles, "#{node[:INITD_DIR]}", false) - -configFiles="ceph.conf" -replace_config_files(configFiles, "#{node[:CEPH_CONF_DIR]}") - -configFiles="ceph-setup" -if node[:NODE_TYPE] == "compute" - if File.file?("#{node[:POSTINSTS_DIR]}#{configFiles}") - execute "Remove file #{configFiles}" do - command "rm #{node[:POSTINSTS_DIR]}#{configFiles}" - end - end -else - replace_config_files(configFiles, "#{node[:INITD_DIR]}", false) -end - -configFiles="keystone.conf identity.sh" -if node[:NODE_TYPE] == "compute" - files = configFiles.split - files.each do | fileName | - if File.file?("#{node[:POSTINSTS_DIR]}#{fileName}") - execute "Remove file #{fileName}" do - command "rm #{node[:POSTINSTS_DIR]}#{fileName}" - end - end - end -else - replace_config_files(configFiles, "#{node[:KEYSTONE_CONF_DIR]}") - #Openrc in keystone conf dir is same as that found in nova - execute "Copy openrc to #{node[:KEYSTONE_CONF_DIR]}" do - command "cp #{node[:NOVA_CONF_DIR]}openrc #{node[:KEYSTONE_CONF_DIR]}" - end -end -#cinder configurations -configFiles="api-paste.ini.cinder cinder.conf" -replace_config_files(configFiles, "#{node[:CINDER_CONF_DIR]}") - -fileName="#{node[:CINDER_CONF_DIR]}api-paste.ini.cinder" -if File.file?(fileName) - execute "Rename api-paste.ini.cinder to api-paste.ini" do - command "mv #{node[:CINDER_CONF_DIR]}api-paste.ini.cinder #{node[:CINDER_CONF_DIR]}api-paste.ini" - end -end -#heat configuration -configFiles="heat.conf" -if node[:NODE_TYPE] == "compute" - if File.file?("#{node[:POSTINSTS_DIR]}#{configFiles}") - execute "Remove file #{configFiles}" do - command "rm #{node[:POSTINSTS_DIR]}#{configFiles}" - end - end -else - replace_config_files(configFiles, "#{node[:HEAT_CONF_DIR]}") -end -#Move the hosts file in place -configFiles="hosts" -replace_config_files(configFiles,"#{node[:ETC_DIR]}") - -=begin -service host[:hostname] do - action :restart -endf -=end diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/ceilometer-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/ceilometer-template.inc deleted file mode 100644 index 471ef1e..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/ceilometer-template.inc +++ /dev/null @@ -1,19 +0,0 @@ -#Ceilometer chefsolo template generation functions - -ceilometer-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/^os_password=.*$/os_password=<%=node[:ADMIN_PASSWORD]%>/" -i $file_name - sed "s/^os_tenant_name=.*$/os_tenant_name= <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name - sed "s/^auth_host=.*$/auth_host=<%=node[:CONTROLLER_IP]%>/" -i $file_name - sed "s/^admin_password=.*$/admin_password= <%=node[:ADMIN_PASSWORD]%>/" -i $file_name - sed "s/^admin_tenant_name=.*$/admin_tenant_name= <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name - - sed "s/^rabbit_host =.*$/rabbit_host = <%=node[:CONTROLLER_IP]%>/" -i $file_name - sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name - sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name - sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name - sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/ceph-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/ceph-template.inc deleted file mode 100644 index 2946808..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/ceph-template.inc +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -#Ceph related chefsolo template functions -ceph-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/mon initial members =.*$/mon initial members = <%=node[:HOST_NAME]%> /" -i $file_name - sed "s/mon host =.*$/mon host = <%=node[:PUBLIC_IP]%>/" -i $file_name - - sed "s:public network =.*/:public network = <%=node[\:CONTROLLER_IP]%>/:" -i $file_name - sed "s/mon.$CONTROLLER_HOST/mon.<%=node[:HOST_NAME]%>/" -i $file_name - sed "s/host =.*$/host = <%=node[:HOST_NAME]%>/" -i $file_name - sed "s#mon addr =.*:#mon addr = <%=node[:PUBLIC_IP]%>:#" -i $file_name - sed "s#public addr =.*:#public addr = <%=node[:PUBLIC_IP]%>:#" -i $file_name - sed "s#cluster addr =.*:#cluster addr = <%=node[:PRIVATE_IP]%>:#" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - -ceph-setup_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/^HOST_NAME.*$/HOST_NAME= <%=node[:HOST_NAME]%> /" -i $file_name - sed "s/^PUBLIC_IP.*$/PUBLIC_IP= <%=node[:PUBLIC_IP]%>/" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/cinder-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/cinder-template.inc deleted file mode 100644 index 4aeb616..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/cinder-template.inc +++ /dev/null @@ -1,21 +0,0 @@ -#Cinder related configuration functions -cinder-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name - sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name - sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - -cinder-api_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name - sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%> /" -i $file_name - sed "s/^admin_password =.*$/admin_password = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/constants.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/constants.inc deleted file mode 100644 index 48994d3..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/constants.inc +++ /dev/null @@ -1,23 +0,0 @@ -#This file is used in the generation of config script -CONTROLLER_HOST="%CONTROLLER_HOST%" -COMPUTE_HOST="%COMPUTE_HOST%" -CONTROLLER_IP="%CONTROLLER_IP%" -COMPUTE_IP="%COMPUTE_IP%" - -DB_USER="%DB_USER%" -DB_PASSWORD="%DB_PASSWORD%" -ADMIN_USER="%ADMIN_USER%" -ADMIN_TENANT_NAME="%ADMIN_PASSWORD%" - -ADMIN_PASSWORD="%ADMIN_PASSWORD%" -SERVICE_PASSWORD="%SERVICE_PASSWORD%" -SERVICE_TENANT_NAME="%SERVICE_TENANT_NAME%" - -SERVICE_USER="%SERVICE_USER%" -SERVICE_TOKEN="%SERVICE_TOKEN%" -DEMO_USER="%DEMO_USER%" -DEMO_PASSWORD="%DEMO_PASSWORD%" - -OS_TENANT_NAME="%OS_TENANT_NAME%" -OS_USERNAME="%OS_USERNAME%" -OS_PASSWORD="%OS_PASSWORD%" diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/glance-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/glance-template.inc deleted file mode 100644 index cbf3264..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/glance-template.inc +++ /dev/null @@ -1,16 +0,0 @@ -#Glance related configuration functions -glance_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name - sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name - sed "s/^swift_store_user =.*$/swift_store_user = <%=node[:SERVICE_TENANT_NAME]%>:glance/" -i $file_name - sed "s/^swift_store_key =.*$/swift_store_key = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name - - sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name - sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%> /" -i $file_name - sed "s/^admin_password =.*$/admin_password = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name - sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/heat-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/heat-template.inc deleted file mode 100644 index 578d2e7..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/heat-template.inc +++ /dev/null @@ -1,15 +0,0 @@ -#Heat related configuration function(s) -heat-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name - sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name - sed "s/^auth_host =.*$/auth_host = <%=node[:CONTROLLER_IP]%> /" -i $file_name - sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name - sed "s/^admin_password =.*$/admin_password = <%=node[:ADMIN_PASSWORD]%> /" -i $file_name - sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name - sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/hosts-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/hosts-template.inc deleted file mode 100644 index b7690b8..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/hosts-template.inc +++ /dev/null @@ -1,10 +0,0 @@ -#Hosts related configuration function(s) -hosts_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/$CONTROLLER_IP.*$/<%=node[:CONTROLLER_IP]%> <%=node[:CONTROLLER_HOST]%>/" -i $file_name - sed "s/$COMPUTE_IP*$/<%=node[:COMPUTE_IP]%> <%=node[:COMPUTE_HOST]%>/" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/keystone-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/keystone-template.inc deleted file mode 100644 index dc43639..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/keystone-template.inc +++ /dev/null @@ -1,24 +0,0 @@ -#Keystone related configuration functions -keystone-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - #keystone.conf related - sed "s/^admin_token =.*$/admin_token=<%=node[:SERVICE_TOKEN]%> /" -i $file_name - sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name - sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - -keystone-identity_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - #Identifyy related substitutions - sed "s/^export OS_SERVICE_TOKEN.*$/export OS_SERVICE_TOKEN=<%=node[:SERVICE_TOKEN]%>/" \ - -i $file_name - sed "s/$ADMIN_PASSWORD/<%=node[:ADMIN_PASSWORD]%>/" -i $file_name - sed "s/$SERVICE_TENANT_NAME/<%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name - sed "s/^KEYSTONE_HOST.*$/KEYSTONE_HOST=<%=node[:CONTROLLER_IP]%> /" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/neutron-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/neutron-template.inc deleted file mode 100644 index 4d10607..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/neutron-template.inc +++ /dev/null @@ -1,24 +0,0 @@ -#Neutron chefsolo template generation related function(s) -neutron-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name - sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name - sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%>/" -i $file_name - sed "s/^admin_password =.*$/admin_password =<%=node[:SERVICE_PASSWORD]%>/g" -i $file_name - sed "s/^rabbit_host =.*$/rabbit_host = <%=node[:CONTROLLER_IP]%>/" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - -neutron-plugins_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name - sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name - sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name - sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/nova-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/nova-template.inc deleted file mode 100644 index 74b0d4c..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/nova-template.inc +++ /dev/null @@ -1,47 +0,0 @@ -#Nova chefsolo template generation functions -openrc_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/^export OS_TENANT_NAME=.*$/export OS_TENANT_NAME=<%=node[:OS_TENANT_NAME]%> /" -i $file_name - sed "s/^export OS_USERNAME=.*$/export OS_USERNAME=<%=node[:OS_USERNAME]%> /" -i $file_name - sed "s/^export OS_PASSWORD=.*$/export OS_PASSWORD=<%=node[:OS_PASSWORD]%> /" -i $file_name - sed "s/^export SERVICE_TOKEN=.*$/export SERVICE_TOKEN=<%=node[:SERVICE_TOKEN]%> /" -i $file_name - sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - -nova-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name - sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name - sed "s/$COMPUTE_IP/<%=node[:COMPUTE_IP]%>/g" -i $file_name - sed "s/$DB_USER:/<%=node[:DB_USER]%>:/g" -i $file_name - sed "s/$DB_PASSWORD@/<%=node[:DB_PASSWORD]%>@/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - -api-paste_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/auth_host =.*$/auth_host = <%=node[:CONTROLLER_IP]%> /" -i $file_name - sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name - sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%> /" -i $file_name - sed "s/^admin_password =.*$/admin_password = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name - sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - -deploy-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name - sed "s/$CONTROLLER_HOST/<%=node[:CONTROLLER_HOST]%>/g" -i $file_name - sed "s/$COMPUTE_IP/<%=node[:COMPUTE_IP]%>/g" -i $file_name - sed "s/$COMPUTE_HOST/<%=node[:COMPUTE_HOST]%>/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/postgresql-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/postgresql-template.inc deleted file mode 100644 index 6022cd2..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/postgresql-template.inc +++ /dev/null @@ -1,12 +0,0 @@ -#Postgresql chefsolo template generation functions -postgresql_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/$CONTROLLER_IP/<%=node[:CONTROLLER_IP]%>/g" -i $file_name - sed "s/$COMPUTE_IP/<%=node[:COMPUTE_IP]%>/g" -i $file_name - sed "s/^DB_USER=.*$/DB_USER=<%=node[:DB_USER]%>/" -i $file_name - sed "s/^DB_PASSWORD=.*$/DB_PASSWORD=<%=node[:DB_PASSWORD]%>/" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - diff --git a/meta-openstack/recipes-support/deploychef/files/conf-templates/swift-template.inc b/meta-openstack/recipes-support/deploychef/files/conf-templates/swift-template.inc deleted file mode 100644 index 4a33536..0000000 --- a/meta-openstack/recipes-support/deploychef/files/conf-templates/swift-template.inc +++ /dev/null @@ -1,37 +0,0 @@ -#Swift chefso template generation functions -dispersion-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/$SERVICE_TENANT_NAME/<%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name - sed "s/$SERVICE_USER/<%=node[:SERVICE_USER]%>/" -i $file_name - sed "s/$SERVICE_PASSWORD/<%=node[:SERVICE_PASSWORD]%>/" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - -test-conf_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/^account =.*$/account = <%=node[:ADMIN_TENANT_NAME]%>/" -i $file_name - sed "s/^username =.*$/username = <%=node[:ADMIN_USER]%>/" -i $file_name - sed "s/^password =.*$/password = <%=node[:ADMIN_PASSWORD]%>/g" -i $file_name - - sed "s/^account2 =.*$/account = <%=node[:SERVICE_TENANT_NAME]%>/" -i $file_name - sed "s/^username2 =.*$/username = <%=node[:SERVICE_USER]%>/" -i $file_name - sed "s/^password2 =.*$/password = <%=node[:SERVICE_PASSWORD]%>/g" -i $file_name - - sed "s/^username3 =.*$/username = <%=node[:DEMO_USER]%>/" -i $file_name - sed "s/^password3 =.*$/password = <%=node[:DEMO_PASSWORD]%>/g" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} - -proxy-server_chefsolo_template() { - file_name=$1 - if [ -e $file_name ]; then - sed "s/^admin_tenant_name =.*$/admin_tenant_name = <%=node[:SERVICE_TENANT_NAME]%> /" -i $file_name - sed "s/^admin_user =.*$/admin_user = <%=node[:SERVICE_USER]%> /" -i $file_name - sed "s/^admin_password =.*$/admin_password = <%=node[:SERVICE_PASSWORD]%> /" -i $file_name - mv $file_name $file_name$SUFFIX - fi -} diff --git a/meta-openstack/recipes-support/deploychef/files/generate-templates b/meta-openstack/recipes-support/deploychef/files/generate-templates deleted file mode 100644 index 178c8c3..0000000 --- a/meta-openstack/recipes-support/deploychef/files/generate-templates +++ /dev/null @@ -1,274 +0,0 @@ -#!/bin/bash -#Location of servics configuration files -D="%SYSCONFDIR%" -TEMPLATES="%DEPLOYCHEF_ROOT_DIR%/cookbooks/openstack/templates/default" -#Chefsolo template suffix -SUFFIX='.erb' -#List of services whose config files needs to be converted to templates -service_list="ceph swift nova heat cinder keystone glance neutron ceilometer init.d" -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/constants.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/nova-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/ceph-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/swift-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/neutron-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/ceilometer-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/glance-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/postgresql-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/keystone-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/cinder-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/heat-template.inc -source %DEPLOYCHEF_ROOT_DIR%/conf-templates/hosts-template.inc - -SRC="${D}/%POSTINSTS_DIR%/" -DST=${TEMPLATES} -#Copy postinstall scripts and make chefsolo templates -postinsts_make_templates(){ - for file in $(ls -h ${SRC}); do - dst_file=${DST}/$file$SUFFIX - install -m 0644 ${SRC}/$file $dst_file - sed 's|ADMIN_PASSWORD=.*$|ADMIN_PASSWORD=<%=node[:ADMIN_PASSWORD]%> \\|' -i $dst_file - sed 's|SERVICE_PASSWORD=.*$|SERVICE_PASSWORD=<%=node[:SERVICE_PASSWORD]%> \\|' -i $dst_file - sed 's|SERVICE_TENANT_NAME=.*$|SERVICE_TENANT_NAME=<%=node[:SERVICE_TENANT_NAME]%> \\|' -i $dst_file - sed "s|$CONTROLLER_IP|<%=node[:CONTROLLER_IP]%>|g" -i $dst_file - sed "s|$CONTROLLER_HOST|<%=node[:CONTROLLER_HOST]%>|g" -i $dst_file - done -} - -#These sets of make_*_templates() helper functions -#copy the respective configuration files if they -#exist and converts them to chefsolo templates -etc-hosts_make_templates(){ - #Creat template file for /etc/hosts - SRC=${D} - DST=${TEMPLATES} - file_name=hosts - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - hosts_chefsolo_template $file_name -} - -make_ceph_templates(){ - file_name=ceph.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - ceph-conf_chefsolo_template $file_name - fi - file_name=ceph-setup - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/../init.d/$file_name ${DST} - file_name="${DST}/$file_name" - ceph-setup_chefsolo_template $file_name - fi -} - -make_swift_templates(){ - file_name='test.conf' - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - test-conf_chefsolo_template $file_name - fi - - file_name='dispersion.conf' - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - dispersion-conf_chefsolo_template $file_name - fi - file_name='proxy-server.conf' - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - proxy-server_chefsolo_template $file_name - fi -} - -make_nova_templates(){ - file_name=nova.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - nova-conf_chefsolo_template $file_name - fi - file_name=openrc - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - openrc_chefsolo_template $file_name - fi - file_name=api-paste.ini - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - api-paste_chefsolo_template $file_name - fi - - file_name=deploy.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - deploy-conf_chefsolo_template $file_name - fi -} - -make_neutron_templates(){ - file_name=neutron.conf - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - neutron-conf_chefsolo_template $file_name - if [ -d ${SRC}/plugins/openvswitch ]; then - file_name=ovs_neutron_plugin.ini - install -m 0644 ${SRC}/plugins/openvswitch/$file_name ${DST} - file_name="${DST}/$file_name" - neutron-plugins_chefsolo_template $file_name - fi - - if [ -d ${SRC}/plugins/linuxbridge ]; then - file_name=linuxbridge_conf.ini - install -m 0644 ${SRC}/plugins/linuxbridge/$file_name ${DST} - file_name="${DST}/$file_name" - neutron-plugins_chefsolo_template $file_name - fi -} -make_heat_templates(){ - file_name=heat.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - heat-conf_chefsolo_template $file_name - fi -} - -make_cinder_templates(){ - file_name=api-paste.ini - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST}/${file_name}.cinder - file_name="${DST}/${file_name}.cinder" - cinder-api_chefsolo_template $file_name - fi - - file_name=cinder.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - cinder-conf_chefsolo_template $file_name - fi -} -make_keystone_templates(){ - file_name=keystone.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - keystone-conf_chefsolo_template $file_name - fi - file_name=identity.sh - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - keystone-identity_chefsolo_template $file_name - fi -} -make_glance_templates(){ - file_name=glance-api.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - glance_chefsolo_template $file_name - fi - - file_name=glance-cache.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - glance_chefsolo_template $file_name - fi - file_name=glance-registry.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - glance_chefsolo_template $file_name - fi -} - -make_ceilometer_templates(){ - - file_name=ceilometer.conf - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - ceilometer-conf_chefsolo_template $file_name - fi -} - -make_postgresql_templates(){ - - file_name=postgresql-init - if [ -f ${SRC}/$file_name ]; then - install -m 0644 ${SRC}/$file_name ${DST} - file_name="${DST}/$file_name" - postgresql_chefsolo_template $file_name - fi -} - - -#This function installs the config/script files of services -#and converts them into templates. -services-conf_make_templates(){ - for mod in ${service_list}; do - if [ -d ${D}/$mod ]; then - SRC=${D}/$mod - DST=${TEMPLATES} - case $mod in - ceph) - #Copy ceph configuration files and convert them to templates - make_ceph_templates - ;; - swift) - #Copy swift configuration files and convert them into - #chefsolo templates - make_swift_templates - - ;; - nova) - #Copy nova configuration files and convert them into - #chefsolo templates - make_nova_templates - ;; - neutron) - #Copy neutron configuration files and convert them into - #chefsolo templates - make_neutron_templates - ;; - heat) - make_heat_templates - ;; - cinder) - make_cinder_templates - ;; - keystone) - make_keystone_templates - ;; - glance) - #Copy glance configuration files and convert them into - #chefsolo templates - make_glance_templates - ;; - ceilometer) - make_ceilometer_templates - ;; - init.d) - make_postgresql_templates - ;; - *) - ;; - esac - echo "Service present in $mod" - fi - done -} - -install -d ${TEMPLATES} -postinsts_make_templates -etc-hosts_make_templates -services-conf_make_templates -- cgit v1.2.3-54-g00ecf