add chef support to install openstack in sle11sp3

Change-Id: I8c12083d5e46f3b43a8df069f77058e3ee965689
This commit is contained in:
xiaodongwang 2015-04-02 17:10:58 -07:00
parent e355f4f18e
commit ddb0e1af4f
56 changed files with 1000 additions and 235 deletions

View File

@ -21,13 +21,18 @@ default['apache']['root_group'] = 'root'
default['apache']['version'] = '2.2'
if node['platform_family'] == 'rhel' && node['platform_version'].to_i > 6
# mysql version is 5.6 on el7
# apache version is 2.4 on el7
default['apache']['version'] = '2.4'
end
if node['platform_family'] == 'debian' && node['platform_version'].to_i > 12
# apache version is 2.4 on ubuntu14.04
default['apache']['version'] = '2.4'
end
# Where the various parts of apache are
case node['platform']
when 'redhat', 'centos', 'scientific', 'fedora', 'suse', 'amazon', 'oracle'
when 'redhat', 'centos', 'scientific', 'fedora', 'amazon', 'oracle'
default['apache']['package'] = 'httpd'
default['apache']['perl_pkg'] = 'perl'
default['apache']['dir'] = '/etc/httpd'
@ -49,6 +54,24 @@ when 'redhat', 'centos', 'scientific', 'fedora', 'suse', 'amazon', 'oracle'
default['apache']['lib_dir'] = node['kernel']['machine'] =~ /^i[36]86$/ ? '/usr/lib/httpd' : '/usr/lib64/httpd'
default['apache']['libexecdir'] = "#{node['apache']['lib_dir']}/modules"
default['apache']['default_site_enabled'] = false
when 'suse'
default['apache']['package'] = 'apache2'
default['apache']['perl_pkg'] = 'perl'
default['apache']['dir'] = '/etc/apache2'
default['apache']['log_dir'] = '/var/log/apache2'
default['apache']['error_log'] = 'error.log'
default['apache']['access_log'] = 'access.log'
default['apache']['user'] = 'wwwrun'
default['apache']['group'] = 'www'
default['apache']['binary'] = '/usr/sbin/httpd2'
default['apache']['docroot_dir'] = '/srv/www'
default['apache']['cgibin_dir'] = '/srv/www/cgi-bin'
default['apache']['icondir'] = '/usr/share/apache2/icons'
default['apache']['cache_dir'] = '/var/cache/apache2'
default['apache']['pid_file'] = '/var/run/httpd2.pid'
default['apache']['lib_dir'] = node['kernel']['machine'] =~ /^i[36]86$/ ? '/usr/lib/apache2' : '/usr/lib64/apache2'
default['apache']['libexecdir'] = "#{node['apache']['lib_dir']}"
default['apache']['default_site_enabled'] = false
when 'debian', 'ubuntu'
default['apache']['package'] = 'apache2'
default['apache']['perl_pkg'] = 'perl'

View File

@ -23,13 +23,17 @@ end
service 'apache2' do
case node['platform_family']
when 'rhel', 'fedora', 'suse'
when 'rhel', 'fedora'
service_name 'httpd'
# If restarted/reloaded too quickly httpd has a habit of failing.
# This may happen with multiple recipes notifying apache to restart - like
# during the initial bootstrap.
restart_command '/sbin/service httpd restart && sleep 1'
reload_command '/sbin/service httpd reload && sleep 1'
when 'suse'
service_name 'apache2'
restart_command '/sbin/service apache2 restart && sleep 1'
reload_command '/sbin/service apache2 reload && sleep 1'
when 'debian'
service_name 'apache2'
restart_command '/usr/sbin/invoke-rc.d apache2 restart && sleep 1'
@ -70,12 +74,23 @@ if platform_family?('rhel', 'fedora', 'arch', 'suse', 'freebsd')
action :nothing
end
%w[a2ensite a2dissite a2enmod a2dismod].each do |modscript|
template "/usr/sbin/#{modscript}" do
source "#{modscript}.erb"
mode '0700'
owner 'root'
group node['apache']['root_group']
if platform_family?('suse')
%w[a2ensite a2dissite].each do |modscript|
template "/usr/sbin/#{modscript}" do
source "#{modscript}.erb"
mode '0700'
owner 'root'
group node['apache']['root_group']
end
end
else
%w[a2ensite a2dissite a2enmod a2dismod].each do |modscript|
template "/usr/sbin/#{modscript}" do
source "#{modscript}.erb"
mode '0700'
owner 'root'
group node['apache']['root_group']
end
end
end
@ -146,13 +161,22 @@ template '/etc/sysconfig/httpd' do
only_if { platform_family?('rhel', 'fedora') }
end
template '/etc/sysconfig/apache2' do
source 'etc-sysconfig-apache2.erb'
owner 'root'
group node['apache']['root_group']
mode '0644'
notifies :restart, 'service[apache2]'
only_if { platform_family?('suse') }
end
template 'apache2.conf' do
case node['platform_family']
when 'rhel', 'fedora', 'arch'
path "#{node['apache']['dir']}/conf/httpd.conf"
when 'debian'
path "#{node['apache']['dir']}/apache2.conf"
when 'freebsd'
when 'freebsd', 'suse'
path "#{node['apache']['dir']}/httpd.conf"
end
source 'apache2.conf.erb'

View File

@ -17,6 +17,8 @@
# limitations under the License.
#
apache_module 'deflate' do
conf true
if platform_family?('rhel', 'fedora', 'debian')
apache_module 'deflate' do
conf true
end
end

View File

@ -20,8 +20,10 @@
package 'libapache2-mod-jk' do
case node['platform_family']
when 'rhel', 'fedora', 'suse'
when 'rhel', 'fedora'
package_name 'mod_jk'
when 'suse'
package 'apache2-mod_jk'
else
package_name 'libapache2-mod-jk'
end

View File

@ -30,6 +30,12 @@ when 'rhel', 'fedora'
end
package 'perl-libapreq2'
when 'suse'
package 'apache2-mod_perl' do
notifies :run, 'execute[generate-module-list]', :immediately
end
package 'apache2-prefork'
end
file "#{node['apache']['dir']}/conf.d/perl.conf" do

View File

@ -20,6 +20,8 @@
case node['platform_family']
when 'debian'
package 'libapache2-mod-php5'
when 'suse'
package 'apache2-mod_php53'
when 'arch'
package 'php-apache' do
notifies :run, 'execute[generate-module-list]', :immediately

View File

@ -24,6 +24,10 @@ when 'rhel', 'fedora'
package 'mod_python' do
notifies :run, 'execute[generate-module-list]', :immediately
end
when 'suse'
package 'apache2-mod_python' do
notifies :run, 'execute[generate-module-list]', :immediately
end
end
file "#{node['apache']['dir']}/conf.d/python.conf" do

View File

@ -20,7 +20,7 @@ unless node['apache']['listen_ports'].include?('443')
node.set['apache']['listen_ports'] = node['apache']['listen_ports'] + ['443']
end
if platform_family?('rhel', 'fedora', 'suse')
if platform_family?('rhel', 'fedora')
package 'mod_ssl' do
notifies :run, 'execute[generate-module-list]', :immediately
end
@ -31,6 +31,17 @@ if platform_family?('rhel', 'fedora', 'suse')
end
end
if platform_family?('suse')
package 'apache2-mod_security2' do
notifies :run, 'execute[generate-module-list]', :immediately
end
file "#{node['apache']['dir']}/conf.d/ssl.conf" do
action :delete
backup false
end
end
template "#{node['apache']['dir']}/ports.conf" do
source 'ports.conf.erb'
mode '0644'

View File

@ -24,6 +24,10 @@ when 'rhel', 'fedora', 'arch'
package 'mod_wsgi' do
notifies :run, 'execute[generate-module-list]', :immediately
end
when 'suse'
package 'apache2-mod_wsgi' do
notifies :run, 'execute[generate-module-list]', :immediately
end
end
file "#{node['apache']['dir']}/conf.d/wsgi.conf" do

View File

@ -22,6 +22,8 @@ LockFile logs/accept.lock
<% end -%>
<% elsif %w[freebsd].include?(node['platform_family']) -%>
LockFile /var/log/accept.lock
<% elsif %w[suse].include?(node['platform_family']) -%>
LockFile logs/accept.lock
<% else %>
LockFile logs/accept.lock
<% end -%>
@ -101,6 +103,11 @@ Include conf.modules.d/*.conf
User <%= node['apache']['user'] %>
Group <%= node['apache']['group'] %>
<% if %w[suse].include?(node['platform_family']) -%>
# generated from APACHE_MODULES in /etc/sysconfig/apache2
Include /etc/apache2/sysconfig.d/loadmodule.conf
<% end -%>
#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
@ -114,7 +121,7 @@ AccessFileName .htaccess
# viewed by Web clients.
#
<Files ~ "^\.ht">
Order allow,deny
Order Allow,Deny
Deny from all
</Files>
@ -221,7 +228,7 @@ LogFormat "%{User-agent}i" agent
# Options IncludesNoExec
# AddOutputFilter Includes html
# AddHandler type-map var
# Order allow,deny
# Order Allow,Deny
# Allow from all
# LanguagePriority en cs de es fr it nl sv pt-br ro
# ForceLanguagePriority Prefer Fallback
@ -245,7 +252,14 @@ LogFormat "%{User-agent}i" agent
# ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
# ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var
<% if %w[suse].include?(node['platform_family']) -%>
# Another way to include your own files
#
# The file below is generated from /etc/sysconfig/apache2,
# include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and
# APACHE_CONF_INCLUDE_DIRS
Include /etc/apache2/sysconfig.d/include.conf
<% end -%>
# Include generic snippets of statements
Include <%= node['apache']['dir'] %>/conf.d/*.conf

View File

@ -0,0 +1,307 @@
## Path: Network/WWW/Apache/SuSEhelp
## Description: SuSE help doc server configuration
## Type: yesno
## Default: no
## Config: apache
## ServiceRestart: apache
## Command:
#
# Set this to yes on the central documentation server
# or to configure apache for local use of susehelp.
# Then the online-help-system indices are automatically adjusted
# and access to the help-files is allowed as specified in DOC_ALLOW.
# To run as a client for the central documentation server who's name
# is specified in DOC_HOST, just set DOC_SERVER to no.
# The DOC_HOST and DOC_ALLOW variables are in the file /etc/sysconfig/susehelp.
#
DOC_SERVER="no"
## Path: Network/WWW/Apache2
## Description: Configuration for Apache 2
## Type: string
## Default: ""
## ServiceRestart: apache2
#
# Here you can name files, separated by spaces, that should be Include'd from
# httpd.conf.
#
# This allows you to add e.g. VirtualHost statements without touching
# /etc/apache2/httpd.conf itself, which makes upgrading easier.
#
APACHE_CONF_INCLUDE_FILES=""
## Type: string
## Default: ""
## ServiceRestart: apache2
#
# Here you can name directories, separated by spaces, that should be Include'd
# from httpd.conf.
#
# All files contained in these directories will be recursively included by apache.
# If a pattern like *.conf is appended, apache will use it.
#
# Examples: "/etc/apache2/my_conf/"
# "/etc/apache2/virtual_hosts/*.conf"
# "local/*.conf /srv/www/virtual/"
#
APACHE_CONF_INCLUDE_DIRS=""
## Type: string
## Default: "actions alias auth_basic authz_host authn_file authz_groupfile authz_default authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5"
## ServiceRestart: apache2
#
# [It might look silly to not simply edit httpd.conf for the LoadModule statements.
# However, since the LoadModule statements might need an absolute path to the modules,
# switching between MPMs can be quite a hassle. It's easier to just give the names here.]
#
# * list of all modules shipped with the base distribution:
#
# actions alias asis auth_basic auth_digest authn_alias authn_anon
# authn_dbd authn_dbm authn_default authn_file authnz_ldap authz_dbm
# authz_default authz_groupfile authz_host authz_owner authz_user
# autoindex bucketeer cache case_filter case_filter_in cern_meta cgi
# charset_lite dav dav_fs dav_lock dbd deflate dir disk_cache dumpio
# echo env expires ext_filter file_cache filter headers ident imagemap
# include info ldap log_config log_forensic logio mem_cache mime mime_magic
# negotiation optional_fn_export optional_fn_import optional_hook_export
# optional_hook_import proxy proxy_ajp proxy_balancer proxy_connect
# proxy_ftp proxy_http reqtimeout rewrite setenvif speling ssl status
# substitute suexec unique_id userdir usertrack version vhost_alias
#
# see http://httpd.apache.org/docs-2.2/mod/ !
#
# * It pays to use IfDefine statements... like
# <IfModule mod_xyz.c>
# ....
# </IfModule>
#
# * In the APACHE_MODULES variable, you can use mod_xyz or just xyz syntax.
# You may also name an absolute path if you like.
#
# * NOTE ON SSL: before you can use mod_ssl, you need a server certificate.
# A test certificate can be created by entering
# 'cd /usr/share/doc/packages/apache2; ./certificate.sh' as root.
# Also, you need to set the ServerName inside the <VirtualHost _default_:443>
# block to the fully qualified domain name (see /etc/HOSTNAME).
# * if your server certificate is protected by a passphrase you should increase the
# APACHE_START_TIMEOUT (see above)
# * to finally enable ssl support, you need to add 'SSL' to APACHE_SERVER_FLAGS
# below.
#
# * modules listed here will be ignored if they are not installed
#
#
# EXAMPLES:
#
# fairly minimal
# APACHE_MODULES="authz_host alias auth dir log_config mime setenvif"
#
# apache's default installation
# APACHE_MODULES="authz_host actions alias asis auth autoindex cgi dir imap include log_config mime negotiation setenvif status userdir"
# your settings
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif status ssl suexec userdir php5 reqtimeout"
## Type: string
## Default: ""
## ServiceRestart: apache2
#
# Additional server flags:
#
# Put here any server flags ("Defines") that you want to hand over to
# httpd at start time, or other command line flags.
#
# Background: Any directives within an <IfDefine flag>...</IfDefine>
# section are only processed if the flag is defined.
# This allows to write configuration which is active only in a
# special cases, like during server maintenance, or for testing
# something temporarily.
#
# Notably, to enable ssl support, 'SSL' needs to be added here.
# To enable the server-status, 'STATUS' needs to be added here.
#
# It does not matter if you write flag1, -D flag1 or -Dflag1.
# Multiple flags can be given as "-D flag1 -D flag2" or simply "flag1 flag2".
#
# Specifying such flags here is equivalent to giving them on the commandline.
# (e.g. via rcapache2 start -DReverseProxy)
#
# Example:
# "SSL STATUS AWSTATS SVN_VIEWCVS no_subversion_today"
#
APACHE_SERVER_FLAGS=""
## Type: string
## Default: ""
## ServiceRestart: apache2
#
# Which config file do you want to use?
# (if not set, /etc/apache2/httpd.conf is used.)
# It is unusual to need to use this setting.
#
# Note about ulimits:
# if you want to set ulimits, e.g. to increase the max number of open file handle,
# or to allow core files, you can do so by editing /etc/sysconfig/apache2 and
# simply write the ulimit commands into that file.
# Example:
# ulimit -n 16384
# ulimit -H -n 16384
# ulimit -c unlimited
# See the output of "help ulimit" in the bash, or "man 1 ulimit".
#
APACHE_HTTPD_CONF=""
## Type: list(prefork,worker)
## Default: ""
## ServiceRestart: apache2
#
# MPM (multi-processing module) to use.
#
# Needed to determine with which MPM apache will run, as well as
# against which header files modules will be built.
#
# If not set, the system will simply pick one of the installed MPMs.
#
# The implementation of the logic is in /usr/share/apache2/find_mpm,
# a script which can be used standalone as well if needed.
#
APACHE_MPM=""
## Type: string
## Default: ""
## ServiceReload: apache2
#
# email address of the server administrator (ServerAdmin directive)
# This address is added to the server's responses if APACHE_SERVERSIGNATURE
# is set to "email".
#
# If empty ("") it defaults to webmaster@$FQHOSTNAME, where FQHOSTNAME is
# taken from /etc/HOSTNAME.
#
# Note that ServerAdmin directives inside VirtualHost statements are not
# changed, even not the one in the stock SSL virtual host block.
#
APACHE_SERVERADMIN=""
## Type: string
## Default: ""
## ServiceReload: apache2
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
APACHE_SERVERNAME=""
## Type: integer
## Default: 2
#
# timeout during server startup (seconds)
# after this time, the start script decides wether the httpd process started without error.
#
# Increase it, if you use mod_ssl and your certificate is passphrase protected!
#
APACHE_START_TIMEOUT="2"
## Type: list(on,off,email)
## Default: "on"
## ServiceReload: apache2
#
# Configures the footer on server-generated documents
# This correlates to the ServerSignature directive.
#
APACHE_SERVERSIGNATURE="on"
## Type: list(debug,info,notice,warn,error,crit,alert,emerg)
## Default: "warn"
## ServiceReload: apache2
#
# LogLevel: Control the number of messages logged to the error_log.
#
APACHE_LOGLEVEL="warn"
## Type: string
## Default: "/var/log/apache2/access_log combined"
## ServiceRestart: apache2
#
# The location and format of the access logfile (Common Logfile Format).
# If you do not define any access logfiles within a <VirtualHost>
# container, they will be logged here. Contrarywise, if you *do*
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
# Simply set it to empty, if you configure it yourself somewhere else.
#
# Examples:
#
# If you would like to have agent and referer logfiles:
#
# setting it to "/var/log/apache2/referer_log referer, /var/log/apache2/agent_log agent"
# corresponds to
# CustomLog /var/log/apache2/referer_log referer
# CustomLog /var/log/apache2/agent_log agent
#
# If you prefer a single logfile with access, agent, and referer information
# (Combined Logfile Format):
#
# setting it to "/var/log/apache2/access_log combined"
# corresponds to
# CustomLog /var/log/apache2/access_log combined
#
APACHE_ACCESS_LOG="/var/log/apache2/access_log combined"
## Type: list(On,Off,DNS)
## Default: "Off"
## ServiceReload: apache2
#
# UseCanonicalName: Determines how Apache constructs self-referencing
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client. When set "On", Apache will use the value of the
# ServerName directive.
#
APACHE_USE_CANONICAL_NAME="off"
## Type: list(Major,Minor,Minimal,ProductOnly,OS,Full)
## Default: "OS"
## ServiceReload: apache2
#
# How much information the server response header field contains about the server.
# (installed modules, versions, etc.)
# see http://httpd.apache.org/docs-2.2/mod/core.html#servertokens
#
APACHE_SERVERTOKENS="OS"
## Type: list(on,off)
## Default: "off"
## ServiceReload: apache2
#
# If mod_status is used, include extended information about the server, like
# CPU usage, in the status report. It is a server-wide setting, and it can cost
# some performance!
#
APACHE_EXTENDED_STATUS="off"
## Type: list(on,off)
## Default: "off"
## ServiceReload: apache2
#
# disable SSL/TLS compression? SSL compression may consume considerable
# computation power on your server. You can disable SSL Compression here; by
# consequence, the environment variable "OPENSSL_NO_DEFAULT_ZLIB" will be
# inherited to apache by the start script. This variable then is evaluated
# by the openssl library on SLES11-SP1+, and compression will be disabled
# if the variable is present in the environment.
# Setting this to "off" (default) will not cause any change in behaviour.
# Setting this to "on" will siply disable compression, for the case when
# a client requests it.
APACHE_DISABLE_SSL_COMPRESSION="on"

View File

@ -41,6 +41,8 @@
#SSLSessionCache dbm:/var/run/apache2/ssl_scache
<% if %w[rhel fedora suse].include?(node['platform_family']) -%>
SSLSessionCache shmcb:/var/cache/mod_ssl/scache(512000)
<% elsif %w[suse].include?(node['platform_family']) -%>
SSLSessionCache shmcb:/var/lib/apache2/ssl_scache(512000)
<% elsif %w[freebsd].include?(node['platform_family']) -%>
SSLSessionCache shmcb:/var/run/ssl_scache(512000)
<% else -%>

View File

@ -7,7 +7,7 @@
<Directory <%= @params[:docroot] %>>
Options <%= [@params[:directory_options] || "FollowSymLinks" ].flatten.join " " %>
AllowOverride <%= [@params[:allow_override] || "None" ].flatten.join " " %>
Order allow,deny
Order Allow,Deny
Allow from all
</Directory>

View File

@ -33,15 +33,17 @@ when "debian"
end
end
node["collectd"]["plugins"].each_pair do |plugin_key, options|
collectd_plugin plugin_key do
options options
if node["platform_family"] != 'suse'
node["collectd"]["plugins"].each_pair do |plugin_key, options|
collectd_plugin plugin_key do
options options
end
end
end
#for python plugins or more complicated ones, use seperate recipe to deploy them
if node["collectd"].attribute?("included_plugins") and not node["collectd"]["included_plugins"].nil?
node["collectd"]["included_plugins"].each_pair do |plugin_key, options|
include_recipe("collectd::#{plugin_key}")
#for python plugins or more complicated ones, use seperate recipe to deploy them
if node["collectd"].attribute?("included_plugins") and not node["collectd"]["included_plugins"].nil?
node["collectd"]["included_plugins"].each_pair do |plugin_key, options|
include_recipe("collectd::#{plugin_key}")
end
end
end

View File

@ -20,34 +20,36 @@
include_recipe "collectd"
include_recipe "apache2"
%w(libhtml-parser-perl liburi-perl librrds-perl libjson-perl).each do |name|
package name
end
directory node[:collectd][:collectd_web][:path] do
owner "root"
group "root"
mode "755"
end
bash "install_collectd_web" do
user "root"
cwd node[:collectd][:collectd_web][:path]
not_if do
File.exists?(File.join(node[:collectd][:collectd_web][:path], "index.html"))
if node['platform_family'] != 'suse'
%w(libhtml-parser-perl liburi-perl librrds-perl libjson-perl).each do |name|
package name
end
code <<-EOH
wget --no-check-certificate -O collectd-web.tar.gz https://github.com/httpdss/collectd-web/tarball/master
tar --strip-components=1 -xzf collectd-web.tar.gz
rm collectd-web.tar.gz
EOH
end
template "/etc/apache2/sites-available/collectd_web.conf" do
source "collectd_web.conf.erb"
owner "root"
group "root"
mode "644"
end
directory node[:collectd][:collectd_web][:path] do
owner "root"
group "root"
mode "755"
end
apache_site "collectd_web.conf"
bash "install_collectd_web" do
user "root"
cwd node[:collectd][:collectd_web][:path]
not_if do
File.exists?(File.join(node[:collectd][:collectd_web][:path], "index.html"))
end
code <<-EOH
wget --no-check-certificate -O collectd-web.tar.gz https://github.com/httpdss/collectd-web/tarball/master
tar --strip-components=1 -xzf collectd-web.tar.gz
rm collectd-web.tar.gz
EOH
end
template "/etc/apache2/sites-available/collectd_web.conf" do
source "collectd_web.conf.erb"
owner "root"
group "root"
mode "644"
end
apache_site "collectd_web.conf"
end

View File

@ -39,92 +39,94 @@ when "debian"
end
end
node[:collectd][:package_name].each do |pkg|
package pkg do
action :install
if node["platform_family"] != 'suse'
node[:collectd][:package_name].each do |pkg|
package pkg do
action :install
end
end
end
unless node[:collectd][:service_file].nil? or node[:collectd][:service_file].empty?
template node[:collectd][:service_file] do
source "collectd_service.erb"
unless node[:collectd][:service_file].nil? or node[:collectd][:service_file].empty?
template node[:collectd][:service_file] do
source "collectd_service.erb"
owner "root"
group "root"
mode "644"
end
end
service "collectd" do
supports :restart => true, :status => true
end
directory "/etc/collectd" do
owner "root"
group "root"
mode "644"
mode "755"
end
end
service "collectd" do
supports :restart => true, :status => true
end
directory "/etc/collectd/plugins" do
owner "root"
group "root"
mode "755"
end
directory "/etc/collectd" do
owner "root"
group "root"
mode "755"
end
directory node[:collectd][:base_dir] do
owner "root"
group "root"
mode "755"
recursive true
end
directory "/etc/collectd/plugins" do
owner "root"
group "root"
mode "755"
end
directory node[:collectd][:plugin_dir] do
owner "root"
group "root"
mode "755"
recursive true
end
directory node[:collectd][:base_dir] do
owner "root"
group "root"
mode "755"
recursive true
end
%w(collection thresholds).each do |file|
template "/etc/collectd/#{file}.conf" do
source "#{file}.conf.erb"
owner "root"
group "root"
mode "644"
notifies :restart, resources(:service => "collectd")
end
end
directory node[:collectd][:plugin_dir] do
owner "root"
group "root"
mode "755"
recursive true
end
%w(collection thresholds).each do |file|
template "/etc/collectd/#{file}.conf" do
source "#{file}.conf.erb"
template node[:collectd][:config_file] do
source "collectd.conf.erb"
owner "root"
group "root"
mode "644"
notifies :restart, resources(:service => "collectd")
end
end
template node[:collectd][:config_file] do
source "collectd.conf.erb"
owner "root"
group "root"
mode "644"
notifies :restart, resources(:service => "collectd")
end
ruby_block "delete_old_plugins" do
block do
Dir['/etc/collectd/plugins/*.conf'].each do |path|
autogen = false
File.open(path).each_line do |line|
if line.start_with?('#') and line.include?('autogenerated')
autogen = true
break
ruby_block "delete_old_plugins" do
block do
Dir['/etc/collectd/plugins/*.conf'].each do |path|
autogen = false
File.open(path).each_line do |line|
if line.start_with?('#') and line.include?('autogenerated')
autogen = true
break
end
end
end
if autogen
begin
resources(:template => path)
rescue ArgumentError, Chef::Exceptions::ResourceNotFound
# If the file is autogenerated and has no template it has likely been removed from the run list
Chef::Log.info("Deleting old plugin config in #{path}")
File.unlink(path)
if autogen
begin
resources(:template => path)
rescue ArgumentError, Chef::Exceptions::ResourceNotFound
# If the file is autogenerated and has no template it has likely been removed from the run list
Chef::Log.info("Deleting old plugin config in #{path}")
File.unlink(path)
end
end
end
end
end
end
service "collectd" do
action [:enable, :start]
service "collectd" do
action [:enable, :start]
end
end

View File

@ -16,28 +16,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
cookbook_file "#{node['collectd']['plugin_dir']}/kairosdb_writer.py" do
source "kairosdb_writer.py"
owner "root"
group "root"
mode 00644
action :create_if_missing
notifies :restart, resources(:service => "collectd")
end
if ! node['cluster']
node.set['cluster'] = "no_cluster_defined"
end
if node['platform_family'] != 'suse'
cookbook_file "#{node['collectd']['plugin_dir']}/kairosdb_writer.py" do
source "kairosdb_writer.py"
owner "root"
group "root"
mode 00644
action :create_if_missing
notifies :restart, resources(:service => "collectd")
end
node.set['collectd']['client']['fqdn'] = node['fqdn'] || node['hostname'] || node['ipaddress'] || "fqdn_unknown"
if ! node['cluster']
node.set['cluster'] = "no_cluster_defined"
end
collectd_python_plugin "kairosdb_writer" do
opts = {"KairosDBHost"=>node['collectd']['server']['host'],
"KairosDBPort"=>node['collectd']['server']['port'],
"KairosDBProtocol"=>node['collectd']['server']['protocol'],
"Tags" => "host=#{node['fqdn']}\" \"role=OSROLE\" \"location=China.Beijing.TsingHua\" \"cluster=#{node['cluster']}",
"TypesDB" => node['collectd']['types_db'],
"LowercaseMetricNames"=>"true"
}
options(opts)
node.set['collectd']['client']['fqdn'] = node['fqdn'] || node['hostname'] || node['ipaddress'] || "fqdn_unknown"
collectd_python_plugin "kairosdb_writer" do
opts = {"KairosDBHost"=>node['collectd']['server']['host'],
"KairosDBPort"=>node['collectd']['server']['port'],
"KairosDBProtocol"=>node['collectd']['server']['protocol'],
"Tags" => "host=#{node['fqdn']}\" \"role=OSROLE\" \"location=China.Beijing.TsingHua\" \"cluster=#{node['cluster']}",
"TypesDB" => node['collectd']['types_db'],
"LowercaseMetricNames"=>"true"
}
options(opts)
end
end

View File

@ -17,25 +17,27 @@
# limitations under the License.
#
package "python-requests" do
action :install
end
if node['platform_family'] != 'suse'
package "python-requests" do
action :install
end
cookbook_file File.join(node['collectd']['plugin_dir'], "rabbitmq_info.py") do
source "rabbitmq_info.py"
owner "root"
group "root"
mode "0755"
notifies :restart, resources(:service => "collectd")
end
cookbook_file File.join(node['collectd']['plugin_dir'], "rabbitmq_info.py") do
source "rabbitmq_info.py"
owner "root"
group "root"
mode "0755"
notifies :restart, resources(:service => "collectd")
end
node.override["collectd"]["mq"]["vhost"] = node["openstack"]["mq"]["vhost"]
node.override["collectd"]["mq"]["vhost"] = node["openstack"]["mq"]["vhost"]
collectd_python_plugin "rabbitmq_info" do
opts = { "Vhost" => node["collectd"]["mq"]["vhost"],
"Api" => "http://localhost:15672/api/queues",
"User" => "#{node["openstack"]["mq"]["user"]}",
"Pass" => "#{node["openstack"]["mq"]["password"]}"
}
options(opts)
collectd_python_plugin "rabbitmq_info" do
opts = { "Vhost" => node["collectd"]["mq"]["vhost"],
"Api" => "http://localhost:15672/api/queues",
"User" => "#{node["openstack"]["mq"]["user"]}",
"Pass" => "#{node["openstack"]["mq"]["password"]}"
}
options(opts)
end
end

View File

@ -19,6 +19,8 @@
include_recipe "collectd"
collectd_plugin "network" do
options :listen=>'0.0.0.0'
if node['platform_family'] != 'suse'
collectd_plugin "network" do
options :listen=>'0.0.0.0'
end
end

View File

@ -49,6 +49,10 @@ when 'rhel'
version node['erlang']['esl']['version'] if node['erlang']['esl']['version']
end
when 'suse'
package 'erlang' do
version node['erlang']['esl']['version'] if node['erlang']['esl']['version']
end
end
# There's a small bug in the package for Ubuntu 10.04... this fixes

View File

@ -44,4 +44,7 @@ when 'rhel'
end
package 'erlang'
when 'suse'
package 'erlang'
package 'erlang-debugger'
end

View File

@ -29,6 +29,8 @@ when 'rhel', 'fedora'
include_recipe 'yum-epel'
end
package 'git'
when 'suse'
package 'git-core'
when 'windows'
include_recipe 'git::windows'
when 'mac_os_x'

View File

@ -1,3 +1,5 @@
default['keepalived']['use_distro_version'] = true
default['keepalived']['rpm_package_url'] = nil
default['keepalived']['shared_address'] = true
default['keepalived']['global']['notification_emails'] = 'admin@example.com'
default['keepalived']['global']['notification_email_from'] = "keepalived@#{node['domain'] || 'example.com'}"

View File

@ -55,7 +55,33 @@ when "debian"
end
end
package "keepalived"
if node['platform_family'] == 'suse'
node.default['keepalived']['use_distro_version'] = false
node.default['keepalived']['rpm_package_url'] = "http://download.opensuse.org/repositories/home:/H4T:/network:/ha-clustering/SLE_11_SP3/x86_64/keepalived-1.2.7-7.1.x86_64.rpm"
package "src_vipa"
end
if node['keepalived']['use_distro_version'] or (not node['local_repo'].nil? and not node['local_repo'].empty?)
package "keepalived"
else
rpm_package = node['keepalived']['rpm_package_url']
if rpm_package
if not node['proxy_url'].nil? and not node['proxy_url'].empty?
execute "download_keepalived" do
command "wget #{rpm_package}"
cwd Chef::Config['file_cache_path']
not_if { ::File.exists?(::File.basename(rpm_package)) }
environment ({ 'http_proxy' => node['proxy_url'], 'https_proxy' => node['proxy_url'] })
end
else
remote_file "#{Chef::Config[:file_cache_path]}/#{::File.basename(rpm_package)}" do
source rpm_package
action :create_if_missing
end
end
rpm_package "#{Chef::Config[:file_cache_path]}/#{::File.basename(rpm_package)}"
end
end
if node['keepalived']['shared_address']
case node['platform_family']

View File

@ -26,19 +26,27 @@ end
package 'memcached'
package 'libmemcache-dev' do
case node['platform_family']
when 'rhel', 'fedora'
case node['platform_family']
when 'rhel', 'fedora'
package 'libmemcache-dev' do
package_name 'libmemcached-devel'
when 'smartos'
end
when 'smartos'
package 'libmemcache-dev' do
package_name 'libmemcached'
when 'suse'
if node['platform_version'].to_f < 12
package_name 'libmemcache-devel'
else
package_name 'libmemcached-devel'
end
when 'suse'
unless node['lsb']['description'][/^SUSE Linux Enterprise Server/]
package 'libmemcache-dev' do
if node['platform_version'].to_f < 12
package_name 'libmemcache-devel'
else
package_name 'libmemcached-devel'
end
end
else
end
else
package 'libmemcache-dev' do
package_name 'libmemcache-dev'
end
end

View File

@ -25,7 +25,7 @@ case node['platform_family']
when 'rhel', 'fedora'
default['mysql']['client']['packages'] = %w[postfix mysql mysql-devel]
when 'suse'
default['mysql']['client']['packages'] = %w[mysql-community-server-client libmysqlclient-devel]
default['mysql']['client']['packages'] = %w[mysql-community-client libmysqlclient15 mysql-community-devel]
when 'debian'
if debian_before_squeeze? || ubuntu_before_lucid?
default['mysql']['client']['packages'] = %w[mysql-client libmysqlclient15-dev]

View File

@ -156,6 +156,11 @@ if node['platform_family'] == 'rhel' && node['platform_version'].to_i > 6
default['mysql']['version'] = '5.6'
end
if node['platform_family'] == 'suse' && node['platform_version'].to_i >= 11
# mysql version is 5.6 on sles11sp3
default['mysql']['version'] = '5.6'
end
# security options
# @see http://www.symantec.com/connect/articles/securing-mysql-step-step
# @see http://dev.mysql.com/doc/refman/5.7/en/server-options.html#option_mysqld_chroot

View File

@ -2,13 +2,22 @@ case node['platform_family']
when 'suse'
default['mysql']['data_dir'] = '/var/lib/mysql'
default['mysql']['server']['service_name'] = 'mysql'
default['mysql']['server']['server']['packages'] = %w[mysql-community-server]
default['mysql']['server']['packages'] = %w[mysql-community-server]
default['mysql']['server']['slow_query_log'] = 1
default['mysql']['server']['slow_query_log_file'] = '/var/log/mysql/slow.log'
default['mysql']['server']['basedir'] = '/usr'
default['mysql']['server']['tmpdir'] = ['/tmp']
default['mysql']['server']['directories']['run_dir'] = '/var/run/mysql'
default['mysql']['server']['directories']['log_dir'] = '/var/lib/mysql'
default['mysql']['server']['directories']['slow_log_dir'] = '/var/log/mysql'
default['mysql']['server']['directories']['confd_dir'] = '/etc/mysql/conf.d'
default['mysql']['server']['root_group'] = 'root'
default['mysql']['server']['mysqladmin_bin'] = '/usr/bin/mysqladmin'
default['mysql']['server']['mysql_bin'] = '/usr/bin/mysql'
default['mysql']['server']['conf_dir'] = '/etc'
default['mysql']['server']['confd_dir'] = '/etc/mysql/conf.d'
default['mysql']['server']['socket'] = '/var/run/mysql/mysql.sock'
default['mysql']['server']['pid_file'] = '/var/run/mysql/mysqld.pid'
default['mysql']['server']['old_passwords'] = 1

View File

@ -0,0 +1,87 @@
# require 'pry'
node['mysql']['server']['packages'].each do |name|
package name do
action :install
end
end
#----
node['mysql']['server']['directories'].each do |key, value|
directory value do
owner 'mysql'
group 'mysql'
mode '0755'
action :create
recursive true
end
end
directory node['mysql']['data_dir'] do
owner 'mysql'
group 'mysql'
action :create
recursive true
end
#----
template 'initial-my.cnf' do
path '/etc/my.cnf'
source 'my.cnf.erb'
owner 'root'
group 'root'
mode '0644'
notifies :start, 'service[mysql-start]', :immediately
end
execute '/usr/bin/mysql_install_db' do
command "service #{node['mysql']['server']['service_name']} stop; /usr/bin/mysql_install_db"
action :run
creates '/var/lib/mysql/mysql/user.frm'
notifies :start, 'service[mysql-start]', :immediately
end
# hax
service 'mysql-start' do
service_name node['mysql']['server']['service_name']
action :nothing
end
cmd = assign_root_password_cmd
execute 'assign-root-password' do
command cmd
action :run
only_if "/usr/bin/mysql -u root -e 'show databases;'"
end
template '/etc/mysql_grants.sql' do
source 'grants.sql.erb'
owner 'root'
group 'root'
mode '0600'
action :create
notifies :run, 'execute[install-grants]', :immediately
end
cmd = install_grants_cmd
execute 'install-grants' do
command cmd
action :nothing
notifies :restart, 'service[mysql]', :immediately
end
#----
template 'final-my.cnf' do
path '/etc/my.cnf'
source 'my.cnf.erb'
owner 'root'
group 'root'
mode '0644'
notifies :reload, 'service[mysql]', :immediately
end
service 'mysql' do
service_name node['mysql']['server']['service_name']
supports :status => true, :restart => true, :reload => true
action [:enable, :start]
end

View File

@ -21,6 +21,8 @@
# to debian_before_squeeze? and ubuntu_before_lucid?
::Chef::Recipe.send(:include, Opscode::Mysql::Helpers)
include_recipe "mysql"
case node['platform']
when 'windows'
package_file = node['mysql']['client']['package_file']

View File

@ -16,3 +16,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
case node['platform']
when 'suse'
mysql_repo_package = "http://dev.mysql.com/get/mysql-community-release-sles11-6.noarch.rpm"
if not node['proxy_url'].nil? and not node['proxy_url'].empty?
r = execute "download_mysql_repo" do
command "wget #{mysql_repo_package}"
cwd Chef::Config[:file_cache_path]
not_if { ::File.exists?("mysql-community-release-sles11-6.noarch.rpm") }
environment ({ 'http_proxy' => node['proxy_url'], 'https_proxy' => node['proxy_url'] })
end
r.run_action(:run)
else
r = remote_file "#{Chef::Config[:file_cache_path]}/mysql-community-release-sles11-6.noarch.rpm" do
source mysql_repo_package
end
r.run_action(:create_if_missing)
end
r = rpm_package "#{Chef::Config[:file_cache_path]}/mysql-community-release-sles11-6.noarch.rpm"
r.run_action(:install)
end

View File

@ -20,6 +20,8 @@
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
::Chef::Recipe.send(:include, Opscode::Mysql::Helpers)
include_recipe "mysql"
if Chef::Config[:solo]
missing_attrs = %w[
server_debian_password
@ -44,6 +46,8 @@ when 'rhel'
include_recipe 'mysql::_server_rhel'
when 'debian'
include_recipe 'mysql::_server_debian'
when 'suse'
include_recipe 'mysql::_server_suse'
when 'mac_os_x'
include_recipe 'mysql::_server_mac_os_x'
when 'windows'

View File

@ -255,8 +255,8 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
}
when 'suse'
# operating system user and group names
default['openstack']['block-storage']['user'] = 'openstack-cinder'
default['openstack']['block-storage']['group'] = 'openstack-cinder'
default['openstack']['block-storage']['user'] = 'cinder'
default['openstack']['block-storage']['group'] = 'cinder'
default['openstack']['block-storage']['platform'] = {
'mysql_python_packages' => ['python-mysql'],
'postgresql_python_packages' => ['python-psycopg2'],

View File

@ -22,10 +22,13 @@ include Chef::Mixin::ShellOut
def partition_num resource
cmd = "parted #{resource.device} --script -- p | awk '{print $1}'"
rc = shell_out(cmd)
Chef::Log.info("#{cmd} output: #{rc.stdout}")
p_num = rc.stdout.split.select{|e| e[/\d/]}
if p_num.include? "Number"
last_num = 0
Chef::Log.info("There is not any partition created at #{resource.device} yet.")
else
Chef::Log.info("partition number is #{p_num}")
end
return p_num
end
@ -33,16 +36,22 @@ end
def partition_start_size resource
cmd = "parted #{resource.device} --script -- p | awk '{print $3}' | tail -n 2"
rc = shell_out(cmd)
Chef::Log.info("#{cmd} output: #{rc.stdout}")
resource.start_size = rc.stdout.split[0]
if resource.start_size.include? "End"
resource.start_size = 0
Chef::Log.info("There is no start size found at #{resource.device} yet.")
else
Chef::Log.info("#{resource.device} start size #{resource.start_size}")
end
end
def disk_total_size resource
cmd = "parted #{resource.device} --script -- p | grep #{resource.device} | cut -f 2 -d ':'"
cmd = "parted #{resource.device} --script -- p | grep 'Disk #{resource.device}' | cut -f 2 -d ':'"
rc = shell_out(cmd)
Chef::Log.info("#{cmd} output: #{rc.stdout}")
resource.total_size = rc.stdout.split[0]
Chef::Log.info("#{resource.device} total size #{resource.total_size}")
end
def mklabel resource
@ -50,8 +59,11 @@ def mklabel resource
if not queryresult.include?(new_resource.label_type)
cmd = "parted #{resource.device} --script -- mklabel #{resource.label_type}"
rc = shell_out(cmd)
Chef::Log.info("#{cmd} output: #{rc.stdout}")
if not rc.exitstatus.eql?(0)
Chef::Log.error("Creating disk label was failed.")
else
Chef::Log.info("Creating disk label was successful.")
end
end
end
@ -62,12 +74,14 @@ def mkpart resource
if not resource.start_size.eql?(resource.total_size)
p_num_old = partition_num resource
output = %x{parted #{resource.device} --script -- mkpart #{resource.part_type} #{resource.start_size} -1}
Chef::Log.info("mkpart output: #{output}")
p_num_new = partition_num resource
p_num = (p_num_new - p_num_old)[0]
if p_num.nil?
Chef::Log.error("Making partition was failed.")
else
resource.partition = resource.device + p_num
Chef::Log.info("making partition on #{resource.partition}")
if node['partitions'].nil?
node.set['partitions'] = resource.partition.lines.to_a
else
@ -81,6 +95,7 @@ end
def file_partition_size
output = %x{df -h /}
Chef::Log.info("df output: #{output}")
available_size = (output.lines.to_a[1].split[3].nil?) \
?(output.lines.to_a[1].split + output.lines.to_a[2].split)[3] \
:(output.lines.to_a[1].split[3])
@ -91,9 +106,12 @@ end
def select_loop_device resource
output = %x{losetup -a|grep "/mnt/cinder-volumes"}.split(':')
Chef::Log.info("losetup output: #{output}")
if output.empty?
used_loop_device = %x{losetup -a |cut -f 1 -d ':'}.split
Chef::Log.info("used loop device: #{used_loop_device}")
total_loop_device = %x{ls /dev/loop* | egrep 'loop[0-9]+'}.split
Chef::Log.info("total loop device: #{total_loop_device}")
available_loop = total_loop_device - used_loop_device
if available_loop.nil?
resource.partition = nil
@ -111,12 +129,15 @@ def create_file_partition resource
if not ::File.exist?("/mnt/cinder-volumes")
cmd = "dd if=/dev/zero of=/mnt/cinder-volumes bs=1 count=0 seek=#{file_partition_size}"
rc = shell_out(cmd)
Chef::Log.info("#{cmd} output: #{rc.stdout}")
end
output = %x{losetup -a|grep '/mnt/cinder-volumes'}
output = %x{losetup -a|grep '/mnt/cinder-volumes'}
Chef::Log.info("losetup output: #{output}")
if not output.include?("/mnt/cinder-volumes")
select_loop_device resource
if not resource.partition.nil?
output = %x{losetup #{resource.partition} /mnt/cinder-volumes}
Chef::Log.info("losetup output: #{output}")
end
else
resource.partition = output.split(":")[0]
@ -137,6 +158,7 @@ end
action :create_partition do
if ::File.exist?(new_resource.device)
Chef::Log.info("device #{new_resource.device} exists")
if node['partitions'].nil? or not node['partitions'].any?{|s| s.include?(new_resource.device)}
disk_total_size new_resource
partition_start_size new_resource
@ -145,8 +167,11 @@ action :create_partition do
else
create_disk_partition new_resource
end
else
Chef::Log.info("node partitions: #{node['partitions']}")
end
else
Chef::Log.info("device #{new_resource.device} does not exist")
create_file_partition new_resource
end
new_resource.updated_by_last_action(true)
@ -157,14 +182,17 @@ action :mk_cinder_vol do
Chef::Log.error("\nThere is not any partition created before trying to create a volume.")
else
node['partitions'].each do |partition|
Chef::Log.info("mk cinder vol on #{partition}")
if partition.include?(new_resource.device) or partition.include?("/dev/loop")
query = %x{vgscan |grep cinder-volumes}
Chef::Log.info("vgscan output: #{query}")
if query.eql?("")
execute "vgcreate cinder-volumes #{partition}" do
new_resource.updated_by_last_action(true)
end
else
query = %x{pvscan |grep cinder-volumes|grep #{partition}}
Chef::Log.info("pvscan output: #{query}")
if query.eql?("")
execute "vgextend cinder-volumes #{partition}" do
new_resource.updated_by_last_action(true)

View File

@ -68,7 +68,12 @@ when 'suse'
# Ohai lsb does not work at all on SLES11SP3
# See https://tickets.opscode.com/browse/OHAI-454
# Until then, copy chef's lsb_release parsing code from its lsb module.
package 'lsb-release'
%w{lsb-release}.each do |pkg|
r = package pkg do
action :nothing
end
r.run_action(:install)
end
Mixlib::ShellOut.new('lsb_release -a').run_command.stdout.split("\n").each do |line|
case line

View File

@ -61,8 +61,8 @@ when 'fedora', 'rhel', 'debian'
default['openstack']['compute']['user'] = 'nova'
default['openstack']['compute']['group'] = 'nova'
when 'suse'
default['openstack']['compute']['user'] = 'openstack-nova'
default['openstack']['compute']['group'] = 'openstack-nova'
default['openstack']['compute']['user'] = 'nova'
default['openstack']['compute']['group'] = 'nova'
end
# Options defined in nova.image.glance
@ -187,8 +187,13 @@ default['openstack']['compute']['driver'] = 'libvirt.LibvirtDriver'
default['openstack']['compute']['default_ephemeral_format'] = nil
default['openstack']['compute']['preallocate_images'] = 'none'
default['openstack']['compute']['use_cow_images'] = true
default['openstack']['compute']['vif_plugging_is_fatal'] = 'True'
default['openstack']['compute']['vif_plugging_timeout'] = 360
if node['platform'] == 'suse'
default['openstack']['compute']['vif_plugging_is_fatal'] = 'False'
default['openstack']['compute']['vif_plugging_timeout'] = 10
else
default['openstack']['compute']['vif_plugging_is_fatal'] = 'True'
default['openstack']['compute']['vif_plugging_timeout'] = 360
end
default['openstack']['compute']['libvirt']['virt_type'] = 'kvm'
default['openstack']['compute']['libvirt']['virt_auto'] = false
@ -375,13 +380,20 @@ when 'fedora', 'rhel', 'suse' # :pragma-foodcritic: ~FC024 - won't fix this
}
if platform_family == 'suse'
default['openstack']['compute']['platform']['mysql_python_packages'] = ['python-mysql']
default['openstack']['compute']['platform']['libvirt_packages'] = ['libvirt', 'xrdp']
default['openstack']['compute']['platform']['dbus_service'] = 'dbus'
default['openstack']['compute']['platform']['compute_vncproxy_consoleauth_packages'] = ['openstack-nova-console', 'openstack-nova-consoleauth']
default['openstack']['compute']['platform']['memcache_python_packages'] = ['python-python-memcached']
default['openstack']['compute']['platform']['neutron_python_packages'] = ['python-neutronclient', 'python-pyparsing']
default['openstack']['compute']['platform']['common_packages'] = ['openstack-nova']
default['openstack']['compute']['platform']['kvm_packages'] = ['kvm']
default['openstack']['compute']['platform']['xen_packages'] = ['kernel-xen', 'xen', 'xen-tools']
default['openstack']['compute']['platform']['lxc_packages'] = ['lxc']
default['openstack']['compute']['platform']['mysql_service'] = 'mysql'
default['openstack']['compute']['platform']['nfs_packages'] = ['nfs-utils']
default['openstack']['compute']['platform']['api_ec2_service'] = 'openstack-nova-api-ec2'
default['openstack']['compute']['platform']['api_os_compute_service'] = 'openstack-nova-api-os-compute'
default['openstack']['compute']['platform']['compute_api_metadata_service'] = 'openstack-nova-api-metadata'
end
# Since the bug (https://bugzilla.redhat.com/show_bug.cgi?id=788485) not released in epel yet
# For 'fedora', 'redhat', 'centos', we need set the default value of force_dhcp_release is 'false'

View File

@ -122,6 +122,15 @@ when 'suse'
action :upgrade
end
end
execute "loading qemu modules" do
command "/sbin/modprobe nbd"
not_if "/sbin/lsmod | /usr/bin/grep nbd"
end
execute "add nbd module into load on boot" do
command "/usr/bin/sysconf_addword /etc/sysconfig/kernel MODULES_LOADED_ON_BOOT nbd"
not_if "/usr/bin/grep MODULES_LOADED_ON_BOOT /etc/sysconfig/kernel | /usr/bin/grep nbd"
end
when 'lxc'
node['openstack']['compute']['platform']['lxc_packages'].each do |pkg|

View File

@ -43,11 +43,8 @@ if node['openstack']['compute']['network']['service_type'] == 'nova'
subscribes :restart, resources('template[/etc/nova/nova.conf]')
action :enable
end
else
node['openstack']['compute']['network']['plugins'].each do |plugin|
include_recipe "openstack-network::#{plugin}"
end
end

View File

@ -32,7 +32,7 @@ end
service 'nova-cert' do
service_name platform_options['compute_cert_service']
supports statusi: true, restart: true
supports status: true, restart: true
subscribes :restart, resources('template[/etc/nova/nova.conf]')
action :enable

View File

@ -135,8 +135,13 @@ when 'debian'
end
default['openstack']['dashboard']['dash_path'] = "#{node['openstack']['dashboard']['django_path']}/openstack_dashboard"
default['openstack']['dashboard']['static_path'] = "#{node['openstack']['dashboard']['django_path']}/static"
default['openstack']['dashboard']['stylesheet_path'] = '/usr/share/openstack-dashboard/openstack_dashboard/templates/_stylesheets.html'
if node['platform_family'] == 'suse'
default['openstack']['dashboard']['static_path'] = "#{node['openstack']['dashboard']['dash_path']}/static"
default['openstack']['dashboard']['stylesheet_path'] = "#{node['openstack']['dashboard']['dash_path']}/templates/_stylesheets.html"
else
default['openstack']['dashboard']['static_path'] = "#{node['openstack']['dashboard']['django_path']}/static"
default['openstack']['dashboard']['stylesheet_path'] = '/usr/share/openstack-dashboard/openstack_dashboard/templates/_stylesheets.html'
end
default['openstack']['dashboard']['wsgi_path'] = node['openstack']['dashboard']['dash_path'] + '/wsgi/django.wsgi'
default['openstack']['dashboard']['wsgi_socket_prefix'] = nil
default['openstack']['dashboard']['session_backend'] = 'signed_cookies'

View File

@ -130,6 +130,16 @@ execute 'openstack-dashboard syncdb' do
end
end
case node['platform_family']
when 'suse'
execute 'openstack-dashboard compress' do
cwd node['openstack']['dashboard']['django_path']
environment 'PYTHONPATH' => "/etc/openstack-dashboard:#{node['openstack']['dashboard']['django_path']}:$PYTHONPATH"
command 'python manage.py compress'
action :run
end
end
cert_file = "#{node['openstack']['dashboard']['ssl']['dir']}/certs/#{node['openstack']['dashboard']['ssl']['cert']}"
cert_mode = 00644
cert_owner = 'root'

View File

@ -201,8 +201,8 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
'package_options' => ''
}
when 'suse'
default['openstack']['identity']['user'] = 'openstack-keystone'
default['openstack']['identity']['group'] = 'openstack-keystone'
default['openstack']['identity']['user'] = 'keystone'
default['openstack']['identity']['group'] = 'keystone'
default['openstack']['identity']['platform'] = {
'mysql_python_packages' => ['python-mysql'],
'postgresql_python_packages' => ['python-psycopg2'],

View File

@ -141,8 +141,8 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
'package_overrides' => ''
}
when 'suse'
default['openstack']['image']['user'] = 'openstack-glance'
default['openstack']['image']['group'] = 'openstack-glance'
default['openstack']['image']['user'] = 'glance'
default['openstack']['image']['group'] = 'glance'
default['openstack']['image']['platform'] = {
'postgresql_python_packages' => ['python-psycopg2'],
'mysql_python_packages' => ['python-mysql'],

View File

@ -37,6 +37,13 @@ platform_options['image_client_packages'].each do |pkg|
end
end
if node['platform_family'] == 'suse'
service 'glance-api restart before image upload' do
service_name platform_options['image_api_service']
action :restart
end
end
identity_endpoint = endpoint 'identity-api'
# For glance client, only identity v2 is supported. See discussion on

View File

@ -994,8 +994,8 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
}
when 'suse'
default['openstack']['network']['platform'] = {
'user' => 'openstack-neutron',
'group' => 'openstack-neutron',
'user' => 'neutron',
'group' => 'neutron',
'mysql_python_packages' => ['python-mysql'],
'postgresql_python_packages' => ['python-psycopg2'],
'nova_network_packages' => ['openstack-nova-network'],
@ -1011,8 +1011,7 @@ when 'suse'
'neutron_openvswitch_packages' => ['openvswitch-switch'],
'neutron_openvswitch_agent_packages' => ['openstack-neutron-openvswitch-agent'],
'neutron_linuxbridge_agent_packages' => ['openstack-neutron-linuxbridge-agent'],
'neutron_metadata_agent_packages' => ['openstack-neutron-metadata-agent'],
'neutron_server_packages' => [],
'neutron_server_packages' => ['openstack-neutron-server'],
'neutron_dhcp_agent_service' => 'openstack-neutron-dhcp-agent',
'neutron_l3_agent_service' => 'openstack-neutron-l3-agent',
'neutron_lb_agent_service' => 'openstack-neutron-lbaas-agent',

View File

@ -421,7 +421,7 @@ link plugin_file do
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
action :nothing
only_if { platform_family? %w{fedora rhel} }
only_if { platform_family? %w{fedora rhel suse debian} }
end
node.set['openstack']['network']['plugin_config_file'] = template_file

View File

@ -29,6 +29,13 @@ service_pass = get_password 'service', 'openstack-network'
metadata_secret = get_secret node['openstack']['network']['metadata']['secret_name']
compute_api_endpoint = endpoint 'compute-api' || {}
platform_options['neutron_metadata_agent_packages'].each do |pkg|
package pkg do
action :upgrade
options platform_options['package_overrides']
end
end
template '/etc/neutron/metadata_agent.ini' do
source 'metadata_agent.ini.erb'
owner node['openstack']['network']['platform']['user']
@ -44,13 +51,6 @@ template '/etc/neutron/metadata_agent.ini' do
action :create
end
platform_options['neutron_metadata_agent_packages'].each do |pkg|
package pkg do
action :upgrade
options platform_options['package_overrides']
end
end
service 'neutron-metadata-agent' do
service_name platform_options['neutron_metadata_agent_service']
supports status: true, restart: true

View File

@ -114,7 +114,15 @@ template '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini' do
variables(
local_ip: openvswitch
)
only_if { platform_family?('rhel') }
only_if { platform_family?('rhel', 'suse', 'debian') }
end
template '/etc/init/neutron-plugin-openvswitch-agent.conf' do
source 'neutron-plugin-openvswitch-agent.conf.erb'
owner 'root'
group 'root'
mode 00644
only_if { platform_family?('debian') }
end
service 'neutron-plugin-openvswitch-agent' do
@ -122,9 +130,12 @@ service 'neutron-plugin-openvswitch-agent' do
supports status: true, restart: true
action :enable
subscribes :restart, 'template[/etc/neutron/neutron.conf]'
if platform_family?('rhel')
if platform_family?('rhel', 'suse', 'debian')
subscribes :restart, 'template[/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini]'
end
if platform_family?('debian')
subscribes :restart, 'template[/etc/init/neutron-plugin-openvswitch-agent.conf]'
end
end
execute "chkconfig openvswitch on" do
@ -164,7 +175,7 @@ unless ['nicira', 'plumgrid', 'bigswitch'].include?(main_plugin)
ignore_failure true
command cmd
action :run
not_if "ovs-vsctl brexists #{bridge}"
not_if "ovs-vsctl br-exists #{bridge}"
notifies :restart, "service[neutron-plugin-openvswitch-agent]", :delayed
end
end

View File

@ -0,0 +1,16 @@
description "Neutron OpenvSwitch Plugin Agent"
author "Chuck Short <zulcss@ubuntu.com>"
start on runlevel [2345] and started neutron-ovs-cleanup
stop on runlevel [!2345]
respawn
chdir /var/run
pre-start script
mkdir -p /var/run/neutron
chown neutron:root /var/run/neutron
end script
exec start-stop-daemon --start --chuid neutron --exec /usr/bin/neutron-openvswitch-agent -- --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini --log-file=/var/log/neutron/openvswitch-agent.log

View File

@ -309,6 +309,27 @@ when 'centos'
'override_options' => '',
'swift_statsd_publish' => '/usr/bin/swift-statsd-publish.py'
}
when 'suse'
default['openstack']['object-storage']['platform'] = {
'disk_format' => 'xfs',
'proxy_packages' => %w{openstack-swift-proxy sudo python-iso8601 python-python-memcached},
'object_packages' => %w{openstack-swift-object sudo python-iso8601},
'container_packages' => %w{openstack-swift-container sudo python-iso8601},
'account_packages' => %w{openstack-swift-account sudo cronie python-iso8601},
'swift_packages' => %w{openstack-swift sudo python-iso8601},
'swift_client_packages' => ['python-swiftclient'],
'swauth_packages' => %w{python-swauth sudo python-iso8601},
'rsync_packages' => ['rsync'],
'git_packages' => ['xinetd', 'git-core'],
'service_prefix' => 'openstack-',
'service_suffix' => '',
'git_dir' => '/var/lib/git',
'git_service' => 'git',
'service_provider' => Chef::Provider::Service::Redhat,
'override_options' => '',
'swift_statsd_publish' => '/usr/bin/swift-statsd-publish.py'
}
when 'fedora'
default['openstack']['object-storage']['platform'] = {
'disk_format' => 'xfs',

View File

@ -45,6 +45,8 @@ when 'debian'
mycnf_template = '/etc/mysql/my.cnf'
when 'rhel'
mycnf_template = 'final-my.cnf'
when 'suse'
mycnf_template = 'final-my.cnf'
end
r = resources("template[#{mycnf_template}]")
@ -59,10 +61,12 @@ end
mysql_connection_info = {
host: 'localhost',
username: 'root',
password: super_password
password: super_password,
socket: node['mysql']['server']['socket']
}
mysql_database 'FLUSH PRIVILEGES' do
database_name 'mysql'
connection mysql_connection_info
sql 'FLUSH PRIVILEGES'
action :query
@ -74,6 +78,7 @@ end
#
# http://bugs.mysql.com/bug.php?id=69644
mysql_database 'drop empty localhost user' do
database_name 'mysql'
sql "DELETE FROM mysql.user WHERE User = '' OR Password = ''"
connection mysql_connection_info
action :query
@ -85,6 +90,7 @@ mysql_database 'test' do
end
mysql_database 'FLUSH PRIVILEGES' do
database_name 'mysql'
connection mysql_connection_info
sql 'FLUSH PRIVILEGES'
action :query

View File

@ -97,6 +97,26 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
'heat_api_process_name' => 'heat-api',
'package_overrides' => ''
}
when 'suse'
default['openstack']['orchestration']['user'] = 'heat'
default['openstack']['orchestration']['group'] = 'heat'
default['openstack']['orchestration']['platform'] = {
'mysql_python_packages' => ['python-mysql'],
'postgresql_python_packages' => ['python-psycopg2'],
'heat_common_packages' => ['openstack-heat'],
'heat_client_packages' => ['python-heatclient'],
'heat_api_packages' => ['python-heatclient', 'openstack-heat-api'],
'heat_api_service' => 'openstack-heat-api',
'heat_api_cfn_packages' => ['python-heatclient', 'openstack-heat-api-cfn'],
'heat_api_cfn_service' => 'openstack-heat-api-cfn',
'heat_api_cloudwatch_packages' => ['python-heatclient', 'openstack-heat-api-cloudwatch'],
'heat_api_cloudwatch_service' => 'openstack-heat-api-cloudwatch',
'heat_engine_packages' => ['openstack-heat-engine'],
'heat_engine_service' => 'openstack-heat-engine',
'heat_api_process_name' => 'heat-api',
'package_overrides' => ''
}
when 'debian'
default['openstack']['orchestration']['user'] = 'heat'
default['openstack']['orchestration']['group'] = 'heat'

View File

@ -128,7 +128,7 @@ when "suse"
end
default['postgresql']['dir'] = "/var/lib/pgsql/data"
default['postgresql']['client']['packages'] = %w{postgresql-devel}
default['postgresql']['client']['packages'] = %w{postgresql}
default['postgresql']['server']['packages'] = %w{postgresql-server}
default['postgresql']['contrib']['packages'] = %w{postgresql-contrib}
default['postgresql']['server']['service_name'] = "postgresql"

View File

@ -25,7 +25,7 @@
if node['python']['install_method'] == 'source'
pip_binary = "#{node['python']['prefix_dir']}/bin/pip"
elsif platform_family?("rhel", "fedora")
elsif platform_family?("rhel", "fedora", "suse")
pip_binary = "/usr/bin/pip"
elsif platform_family?("smartos")
pip_binary = "/opt/local/bin/pip"

View File

@ -23,8 +23,8 @@ default["susan2"]=0
default['mysql']['bind_address'] = attribute?('cloud') ? cloud['local_ipv4'] : node["network"]["interfaces"]["eth1"]["addresses"].keys[1]
default['mysql']['port'] = 3306
case node["platform"]
when "centos", "redhat", "fedora", "suse", "scientific", "amazon"
case node["platform_family"]
when 'rhel'
default['mysql']['package_name'] = "mysql-server"
default['mysql']['service_name'] = "mysqld"
default['mysql']['basedir'] = "/usr"
@ -39,9 +39,22 @@ when "centos", "redhat", "fedora", "suse", "scientific", "amazon"
set['mysql']['pid_file'] = "/var/run/mysqld/mysqld.pid"
set['mysql']['old_passwords'] = 1
set['mysql']['grants_path'] = "/etc/mysql_grants.sql"
# RHEL/CentOS mysql package does not support this option.
set['mysql']['tunable']['innodb_adaptive_flushing'] = false
when "freebsd"
when 'debian'
default['mysql']['package_name'] = "mysql-server"
default['mysql']['service_name'] = "mysql"
default['mysql']['basedir'] = "/usr"
default['mysql']['data_dir'] = "/var/lib/mysql"
default['mysql']['root_group'] = "root"
default['mysql']['mysqladmin_bin'] = "/usr/bin/mysqladmin"
default['mysql']['mysql_bin'] = "/usr/bin/mysql"
set['mysql']['conf_dir'] = '/etc/mysql'
set['mysql']['confd_dir'] = '/etc/mysql/conf.d'
set['mysql']['socket'] = "/var/run/mysqld/mysqld.sock"
set['mysql']['pid_file'] = "/var/run/mysqld/mysqld.pid"
set['mysql']['old_passwords'] = 0
set['mysql']['grants_path'] = "/etc/mysql_grants.sql"
when 'freebsd'
default['mysql']['package_name'] = "mysql55-server"
default['mysql']['service_name'] = "mysql-server"
default['mysql']['basedir'] = "/usr/local"
@ -56,23 +69,6 @@ when "freebsd"
set['mysql']['pid_file'] = "/var/run/mysqld/mysqld.pid"
set['mysql']['old_passwords'] = 0
set['mysql']['grants_path'] = "/var/db/mysql/grants.sql"
when "windows"
default['mysql']['package_name'] = "MySQL Server 5.5"
default['mysql']['version'] = '5.5.21'
default['mysql']['arch'] = 'win32'
default['mysql']['package_file'] = "mysql-#{mysql['version']}-#{mysql['arch']}.msi"
default['mysql']['url'] = "http://www.mysql.com/get/Downloads/MySQL-5.5/#{mysql['package_file']}/from/http://mysql.mirrors.pair.com/"
default['mysql']['service_name'] = "mysql"
default['mysql']['basedir'] = "#{ENV['SYSTEMDRIVE']}\\Program Files (x86)\\MySQL\\#{mysql['package_name']}"
default['mysql']['data_dir'] = "#{mysql['basedir']}\\Data"
default['mysql']['bin_dir'] = "#{mysql['basedir']}\\bin"
default['mysql']['mysqladmin_bin'] = "#{mysql['bin_dir']}\\mysqladmin"
default['mysql']['mysql_bin'] = "#{mysql['bin_dir']}\\mysql"
default['mysql']['conf_dir'] = "#{mysql['basedir']}"
default['mysql']['old_passwords'] = 0
default['mysql']['grants_path'] = "#{mysql['conf_dir']}\\grants.sql"
when "mac_os_x"
default['mysql']['package_name'] = "mysql"
default['mysql']['basedir'] = "/usr/local/Cellar"
@ -80,6 +76,40 @@ when "mac_os_x"
default['mysql']['root_group'] = "admin"
default['mysql']['mysqladmin_bin'] = "/usr/local/bin/mysqladmin"
default['mysql']['mysql_bin'] = "/usr/local/bin/mysql"
when 'suse'
default['mysql']['package_name'] = "mysql-server"
default['mysql']['service_name'] = "mysql"
default['mysql']['basedir'] = "/usr"
default['mysql']['data_dir'] = "/var/lib/mysql"
default['mysql']['root_group'] = "root"
default['mysql']['mysqladmin_bin'] = "/usr/bin/mysqladmin"
default['mysql']['mysql_bin'] = "/usr/bin/mysql"
set['mysql']['conf_dir'] = '/etc'
set['mysql']['confd_dir'] = '/etc/mysql/conf.d'
set['mysql']['socket'] = "/var/run/mysql/mysql.sock"
set['mysql']['pid_file'] = "/var/run/mysql/mysqld.pid"
set['mysql']['old_passwords'] = 1
set['mysql']['grants_path'] = "/etc/mysql_grants.sql"
when 'windows'
default['mysql']['package_name'] = "MySQL Server 5.5"
default['mysql']['service_name'] = "mysql"
default['mysql']['version'] = '5.5.34'
default['mysql']['arch'] = node['kernel']['machine'] == 'x86_64' ? 'winx64' : 'win32'
default['mysql']['package_file'] = "mysql-#{node['mysql']['version']}-#{node['mysql']['arch']}.msi"
default['mysql']['url'] = "http://www.mysql.com/get/Downloads/MySQL-5.5/#{node['mysql']['package_file']}"
default['mysql']['programdir'] = node['kernel']['machine'] == 'x86_64' ? 'Program Files' : 'Program Files (x86)'
default['mysql']['service_name'] = "mysql"
default['mysql']['basedir'] = "#{ENV['SYSTEMDRIVE']}\\#{node['mysql']['programdir']}\\MySQL\\#{mysql['package_name']}"
default['mysql']['data_dir'] = "#{ENV['ProgramData']}\\MySQL\\#{node['mysql']['package_name']}\\Data"
default['mysql']['bin_dir'] = "#{mysql['basedir']}\\bin"
default['mysql']['mysqladmin_bin'] = "#{mysql['bin_dir']}\\mysqladmin"
default['mysql']['mysql_bin'] = "#{mysql['bin_dir']}\\mysql"
default['mysql']['conf_dir'] = "#{mysql['basedir']}"
default['mysql']['old_passwords'] = 0
default['mysql']['grants_path'] = "#{mysql['conf_dir']}\\grants.sql"
else
default['mysql']['package_name'] = "mysql-server"
default['mysql']['service_name'] = "mysql"

View File

@ -25,4 +25,7 @@ when "debian"
package "xfslibs-dev"
when "rhel", "fedora"
package"xfsprogs-devel"
when "suse"
package "xfsdump"
package "xfsprogs"
end