Skip to content

Commit

Permalink
Merge branch 'ESPRINT-355'
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimberman committed Sep 13, 2011
2 parents bb02f20 + 545e48a commit 90aedf7
Show file tree
Hide file tree
Showing 24 changed files with 574 additions and 174 deletions.
349 changes: 349 additions & 0 deletions apache2/README.md

Large diffs are not rendered by default.

78 changes: 0 additions & 78 deletions apache2/README.rdoc

This file was deleted.

18 changes: 17 additions & 1 deletion apache2/attributes/default.rb
Expand Up @@ -19,34 +19,50 @@


# Where the various parts of apache are # Where the various parts of apache are
case platform case platform
when "redhat","centos","fedora","suse" when "redhat","centos","scientific","fedora","suse"
set[:apache][:dir] = "/etc/httpd" set[:apache][:dir] = "/etc/httpd"
set[:apache][:log_dir] = "/var/log/httpd" set[:apache][:log_dir] = "/var/log/httpd"
set[:apache][:user] = "apache" set[:apache][:user] = "apache"
set[:apache][:group] = "apache"
set[:apache][:binary] = "/usr/sbin/httpd" set[:apache][:binary] = "/usr/sbin/httpd"
set[:apache][:icondir] = "/var/www/icons/" set[:apache][:icondir] = "/var/www/icons/"
set[:apache][:cache_dir] = "/var/cache/httpd" set[:apache][:cache_dir] = "/var/cache/httpd"
if node.platform_version.to_f >= 6 then
set[:apache][:pid_file] = "/var/run/httpd/httpd.pid"
else
set[:apache][:pid_file] = "/var/run/httpd.pid"
end
set[:apache][:lib_dir] = node[:kernel][:machine] == "i386" ? "/usr/lib/httpd" : "/usr/lib64/httpd"
when "debian","ubuntu" when "debian","ubuntu"
set[:apache][:dir] = "/etc/apache2" set[:apache][:dir] = "/etc/apache2"
set[:apache][:log_dir] = "/var/log/apache2" set[:apache][:log_dir] = "/var/log/apache2"
set[:apache][:user] = "www-data" set[:apache][:user] = "www-data"
set[:apache][:group] = "www-data"
set[:apache][:binary] = "/usr/sbin/apache2" set[:apache][:binary] = "/usr/sbin/apache2"
set[:apache][:icondir] = "/usr/share/apache2/icons" set[:apache][:icondir] = "/usr/share/apache2/icons"
set[:apache][:cache_dir] = "/var/cache/apache2" set[:apache][:cache_dir] = "/var/cache/apache2"
set[:apache][:pid_file] = "/var/run/apache2.pid"
set[:apache][:lib_dir] = "/usr/lib/apache2"
when "arch" when "arch"
set[:apache][:dir] = "/etc/httpd" set[:apache][:dir] = "/etc/httpd"
set[:apache][:log_dir] = "/var/log/httpd" set[:apache][:log_dir] = "/var/log/httpd"
set[:apache][:user] = "http" set[:apache][:user] = "http"
set[:apache][:group] = "http"
set[:apache][:binary] = "/usr/sbin/httpd" set[:apache][:binary] = "/usr/sbin/httpd"
set[:apache][:icondir] = "/usr/share/httpd/icons" set[:apache][:icondir] = "/usr/share/httpd/icons"
set[:apache][:cache_dir] = "/var/cache/httpd" set[:apache][:cache_dir] = "/var/cache/httpd"
set[:apache][:pid_file] = "/var/run/httpd/httpd.pid"
set[:apache][:lib_dir] = "/usr/lib/httpd"
else else
set[:apache][:dir] = "/etc/apache2" set[:apache][:dir] = "/etc/apache2"
set[:apache][:log_dir] = "/var/log/apache2" set[:apache][:log_dir] = "/var/log/apache2"
set[:apache][:user] = "www-data" set[:apache][:user] = "www-data"
set[:apache][:group] = "www-data"
set[:apache][:binary] = "/usr/sbin/apache2" set[:apache][:binary] = "/usr/sbin/apache2"
set[:apache][:icondir] = "/usr/share/apache2/icons" set[:apache][:icondir] = "/usr/share/apache2/icons"
set[:apache][:cache_dir] = "/var/cache/apache2" set[:apache][:cache_dir] = "/var/cache/apache2"
set[:apache][:pid_file] = "logs/httpd.pid"
set[:apache][:lib_dir] = "/usr/lib/apache2"
end end


### ###
Expand Down
15 changes: 12 additions & 3 deletions apache2/definitions/apache_module.rb
Expand Up @@ -19,11 +19,20 @@


define :apache_module, :enable => true, :conf => false do define :apache_module, :enable => true, :conf => false do
include_recipe "apache2" include_recipe "apache2"


params[:filename] = params[:filename] || "mod_#{params[:name]}.so"

if params[:conf] if params[:conf]
apache_conf params[:name] apache_conf params[:name]
end end


if platform?("redhat", "centos", "scientific", "fedora", "arch", "suse" )
file "#{node['apache']['dir']}/mods-available/#{params[:name]}.load" do
content "LoadModule #{params[:name]}_module #{node['apache']['lib_dir']}/modules/#{params[:filename]}\n"
mode 0644
end
end

if params[:enable] if params[:enable]
execute "a2enmod #{params[:name]}" do execute "a2enmod #{params[:name]}" do
command "/usr/sbin/a2enmod #{params[:name]}" command "/usr/sbin/a2enmod #{params[:name]}"
Expand All @@ -32,7 +41,7 @@
((File.exists?("#{node[:apache][:dir]}/mods-available/#{params[:name]}.conf"))? ((File.exists?("#{node[:apache][:dir]}/mods-available/#{params[:name]}.conf"))?
(File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.conf")):(true))) (File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.conf")):(true)))
end end
end end
else else
execute "a2dismod #{params[:name]}" do execute "a2dismod #{params[:name]}" do
command "/usr/sbin/a2dismod #{params[:name]}" command "/usr/sbin/a2dismod #{params[:name]}"
Expand Down
9 changes: 6 additions & 3 deletions apache2/definitions/apache_site.rb
Expand Up @@ -19,12 +19,12 @@


define :apache_site, :enable => true do define :apache_site, :enable => true do
include_recipe "apache2" include_recipe "apache2"

if params[:enable] if params[:enable]
execute "a2ensite #{params[:name]}" do execute "a2ensite #{params[:name]}" do
command "/usr/sbin/a2ensite #{params[:name]}" command "/usr/sbin/a2ensite #{params[:name]}"
notifies :restart, resources(:service => "apache2") notifies :restart, resources(:service => "apache2")
not_if do not_if do
::File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") or ::File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") or
::File.symlink?("#{node[:apache][:dir]}/sites-enabled/000-#{params[:name]}") ::File.symlink?("#{node[:apache][:dir]}/sites-enabled/000-#{params[:name]}")
end end
Expand All @@ -34,7 +34,10 @@
execute "a2dissite #{params[:name]}" do execute "a2dissite #{params[:name]}" do
command "/usr/sbin/a2dissite #{params[:name]}" command "/usr/sbin/a2dissite #{params[:name]}"
notifies :restart, resources(:service => "apache2") notifies :restart, resources(:service => "apache2")
only_if do ::File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") end only_if do
::File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") or
::File.symlink?("#{node[:apache][:dir]}/sites-enabled/000-#{params[:name]}")
end
end end
end end
end end
4 changes: 2 additions & 2 deletions apache2/definitions/web_app.rb
Expand Up @@ -17,7 +17,7 @@
# limitations under the License. # limitations under the License.
# #


define :web_app, :template => "web_app.conf.erb" do define :web_app, :template => "web_app.conf.erb", :enable => true do


application_name = params[:name] application_name = params[:name]


Expand All @@ -44,6 +44,6 @@
end end


apache_site "#{params[:name]}.conf" do apache_site "#{params[:name]}.conf" do
enable enable_setting enable params[:enable]
end end
end end
2 changes: 1 addition & 1 deletion apache2/metadata.rb
Expand Up @@ -2,7 +2,7 @@
maintainer_email "cookbooks@opscode.com" maintainer_email "cookbooks@opscode.com"
license "Apache 2.0" license "Apache 2.0"
description "Installs and configures all aspects of apache2 using Debian style symlinks with helper definitions" description "Installs and configures all aspects of apache2 using Debian style symlinks with helper definitions"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.99.4" version "0.99.4"
recipe "apache2", "Main Apache configuration" recipe "apache2", "Main Apache configuration"
recipe "apache2::mod_alias", "Apache module 'alias' with config file" recipe "apache2::mod_alias", "Apache module 'alias' with config file"
Expand Down

0 comments on commit 90aedf7

Please sign in to comment.