Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit 31f17731ed9a848e466984e240c198d675ee9849 @developish committed Jun 12, 2011
Showing with 14,352 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +4 −0 Gemfile
  3. +33 −0 Gemfile.lock
  4. +26 −0 Readme.md
  5. +53 −0 Vagrantfile
  6. +78 −0 cookbooks/apache2/README.rdoc
  7. +87 −0 cookbooks/apache2/attributes/default.rb
  8. +26 −0 cookbooks/apache2/definitions/apache_conf.rb
  9. +43 −0 cookbooks/apache2/definitions/apache_module.rb
  10. +40 −0 cookbooks/apache2/definitions/apache_site.rb
  11. +49 −0 cookbooks/apache2/definitions/web_app.rb
  12. +41 −0 cookbooks/apache2/files/default/apache2_module_conf_generate.pl
  13. +197 −0 cookbooks/apache2/metadata.rb
  14. +209 −0 cookbooks/apache2/recipes/default.rb
  15. +33 −0 cookbooks/apache2/recipes/god_monitor.rb
  16. +22 −0 cookbooks/apache2/recipes/mod_alias.rb
  17. +20 −0 cookbooks/apache2/recipes/mod_auth_basic.rb
  18. +20 −0 cookbooks/apache2/recipes/mod_auth_digest.rb
  19. +83 −0 cookbooks/apache2/recipes/mod_auth_openid.rb
  20. +20 −0 cookbooks/apache2/recipes/mod_authn_file.rb
  21. +20 −0 cookbooks/apache2/recipes/mod_authnz_ldap.rb
  22. +20 −0 cookbooks/apache2/recipes/mod_authz_default.rb
  23. +20 −0 cookbooks/apache2/recipes/mod_authz_groupfile.rb
  24. +20 −0 cookbooks/apache2/recipes/mod_authz_host.rb
  25. +20 −0 cookbooks/apache2/recipes/mod_authz_user.rb
  26. +22 −0 cookbooks/apache2/recipes/mod_autoindex.rb
  27. +20 −0 cookbooks/apache2/recipes/mod_cgi.rb
  28. +20 −0 cookbooks/apache2/recipes/mod_dav.rb
  29. +22 −0 cookbooks/apache2/recipes/mod_dav_svn.rb
  30. +22 −0 cookbooks/apache2/recipes/mod_deflate.rb
  31. +22 −0 cookbooks/apache2/recipes/mod_dir.rb
  32. +20 −0 cookbooks/apache2/recipes/mod_env.rb
  33. +20 −0 cookbooks/apache2/recipes/mod_expires.rb
  34. +46 −0 cookbooks/apache2/recipes/mod_fcgid.rb
  35. +20 −0 cookbooks/apache2/recipes/mod_headers.rb
  36. +20 −0 cookbooks/apache2/recipes/mod_ldap.rb
  37. +24 −0 cookbooks/apache2/recipes/mod_log_config.rb
  38. +22 −0 cookbooks/apache2/recipes/mod_mime.rb
  39. +22 −0 cookbooks/apache2/recipes/mod_negotiation.rb
  40. +37 −0 cookbooks/apache2/recipes/mod_php5.rb
  41. +22 −0 cookbooks/apache2/recipes/mod_proxy.rb
  42. +20 −0 cookbooks/apache2/recipes/mod_proxy_ajp.rb
  43. +20 −0 cookbooks/apache2/recipes/mod_proxy_balancer.rb
  44. +20 −0 cookbooks/apache2/recipes/mod_proxy_connect.rb
  45. +20 −0 cookbooks/apache2/recipes/mod_proxy_http.rb
  46. +32 −0 cookbooks/apache2/recipes/mod_python.rb
  47. +20 −0 cookbooks/apache2/recipes/mod_rewrite.rb
  48. +22 −0 cookbooks/apache2/recipes/mod_setenvif.rb
  49. +43 −0 cookbooks/apache2/recipes/mod_ssl.rb
  50. +22 −0 cookbooks/apache2/recipes/mod_status.rb
  51. +27 −0 cookbooks/apache2/recipes/mod_wsgi.rb
  52. +22 −0 cookbooks/apache2/templates/default/a2dismod.erb
  53. +29 −0 cookbooks/apache2/templates/default/a2dissite.erb
  54. +37 −0 cookbooks/apache2/templates/default/a2enmod.erb
  55. +38 −0 cookbooks/apache2/templates/default/a2ensite.erb
  56. +232 −0 cookbooks/apache2/templates/default/apache2.conf.erb
  57. +19 −0 cookbooks/apache2/templates/default/apache2.god.erb
  58. +6 −0 cookbooks/apache2/templates/default/charset.erb
  59. +57 −0 cookbooks/apache2/templates/default/default-site.erb
  60. +12 −0 cookbooks/apache2/templates/default/mod_auth_openid.rb.erb
  61. +2 −0 cookbooks/apache2/templates/default/mods/README
  62. +24 −0 cookbooks/apache2/templates/default/mods/alias.conf.erb
  63. +6 −0 cookbooks/apache2/templates/default/mods/authopenid.load.erb
  64. +101 −0 cookbooks/apache2/templates/default/mods/autoindex.conf.erb
  65. +16 −0 cookbooks/apache2/templates/default/mods/deflate.conf.erb
  66. +5 −0 cookbooks/apache2/templates/default/mods/dir.conf.erb
  67. +10 −0 cookbooks/apache2/templates/default/mods/fcgid.conf.erb
  68. +196 −0 cookbooks/apache2/templates/default/mods/mime.conf.erb
  69. +18 −0 cookbooks/apache2/templates/default/mods/negotiation.conf.erb
  70. +19 −0 cookbooks/apache2/templates/default/mods/proxy.conf.erb
  71. +28 −0 cookbooks/apache2/templates/default/mods/setenvif.conf.erb
  72. +72 −0 cookbooks/apache2/templates/default/mods/ssl.conf.erb
  73. +16 −0 cookbooks/apache2/templates/default/mods/status.conf.erb
  74. +2 −0 cookbooks/apache2/templates/default/port_apache.erb
  75. +6 −0 cookbooks/apache2/templates/default/ports.conf.erb
  76. +50 −0 cookbooks/apache2/templates/default/security.erb
  77. +43 −0 cookbooks/apache2/templates/default/web_app.conf.erb
  78. +109 −0 cookbooks/apt/README.md
  79. +9 −0 cookbooks/apt/files/default/apt-cacher
  80. +144 −0 cookbooks/apt/files/default/apt-cacher.conf
  81. +50 −0 cookbooks/apt/files/default/apt-proxy-v2.conf
  82. +13 −0 cookbooks/apt/metadata.rb
  83. +72 −0 cookbooks/apt/providers/repository.rb
  84. +37 −0 cookbooks/apt/recipes/cacher-client.rb
  85. +45 −0 cookbooks/apt/recipes/cacher.rb
  86. +33 −0 cookbooks/apt/recipes/default.rb
  87. +30 −0 cookbooks/apt/resources/repository.rb
  88. +24 −0 cookbooks/build-essential/README.md
  89. +10 −0 cookbooks/build-essential/metadata.rb
  90. +45 −0 cookbooks/build-essential/recipes/default.rb
  91. +37 −0 cookbooks/git/README.rdoc
  92. +16 −0 cookbooks/git/metadata.rb
  93. +24 −0 cookbooks/git/recipes/default.rb
  94. +34 −0 cookbooks/git/recipes/server.rb
  95. +2 −0 cookbooks/git/templates/default/sv-git-daemon-log-run.erb
  96. +3 −0 cookbooks/git/templates/default/sv-git-daemon-run.erb
  97. +137 −0 cookbooks/mysql/README.md
  98. +65 −0 cookbooks/mysql/attributes/server.rb
  99. +19 −0 cookbooks/mysql/libraries/database.rb
  100. +33 −0 cookbooks/mysql/libraries/helpers.rb
  101. +82 −0 cookbooks/mysql/metadata.rb
  102. +81 −0 cookbooks/mysql/providers/database.rb
  103. +52 −0 cookbooks/mysql/recipes/client.rb
  104. +20 −0 cookbooks/mysql/recipes/default.rb
  105. +123 −0 cookbooks/mysql/recipes/server.rb
  106. +49 −0 cookbooks/mysql/recipes/server_ec2.rb
  107. +27 −0 cookbooks/mysql/resources/database.rb
  108. +12 −0 cookbooks/mysql/templates/default/debian.cnf.erb
  109. +15 −0 cookbooks/mysql/templates/default/grants.sql.erb
  110. +177 −0 cookbooks/mysql/templates/default/my.cnf.erb
  111. +10 −0 cookbooks/mysql/templates/default/mysql-server.seed.erb
  112. +3 −0 cookbooks/mysql/templates/default/port_mysql.erb
  113. +37 −0 cookbooks/openssl/README.md
  114. +37 −0 cookbooks/openssl/libraries/secure_password.rb
  115. +8 −0 cookbooks/openssl/metadata.rb
  116. +19 −0 cookbooks/openssl/recipes/default.rb
  117. +243 −0 cookbooks/php/README.md
  118. +85 −0 cookbooks/php/attributes/default.rb
  119. +27 −0 cookbooks/php/metadata.rb
  120. +229 −0 cookbooks/php/providers/pear.rb
  121. +89 −0 cookbooks/php/providers/pear_channel.rb
  122. +31 −0 cookbooks/php/recipes/default.rb
  123. +37 −0 cookbooks/php/recipes/module_apc.rb
  124. +29 −0 cookbooks/php/recipes/module_curl.rb
  125. +29 −0 cookbooks/php/recipes/module_fileinfo.rb
  126. +35 −0 cookbooks/php/recipes/module_fpdf.rb
  127. +29 −0 cookbooks/php/recipes/module_gd.rb
  128. +29 −0 cookbooks/php/recipes/module_ldap.rb
  129. +37 −0 cookbooks/php/recipes/module_memcache.rb
  130. +29 −0 cookbooks/php/recipes/module_mysql.rb
  131. +29 −0 cookbooks/php/recipes/module_pgsql.rb
  132. +30 −0 cookbooks/php/recipes/module_sqlite3.rb
  133. +42 −0 cookbooks/php/recipes/package.rb
  134. +79 −0 cookbooks/php/recipes/source.rb
  135. +28 −0 cookbooks/php/resources/pear.rb
  136. +28 −0 cookbooks/php/resources/pear_channel.rb
  137. +1,221 −0 cookbooks/php/templates/centos/php.ini.erb
  138. +1,853 −0 cookbooks/php/templates/debian/php.ini.erb
  139. +5 −0 cookbooks/php/templates/default/extension.ini.erb
  140. +1,896 −0 cookbooks/php/templates/default/php.ini.erb
  141. +1,221 −0 cookbooks/php/templates/redhat/php.ini.erb
  142. +1,853 −0 cookbooks/php/templates/ubuntu/php.ini.erb
  143. +92 −0 cookbooks/wordpress/README.md
  144. +26 −0 cookbooks/wordpress/attributes/default.rb
  145. +70 −0 cookbooks/wordpress/metadata.rb
  146. +129 −0 cookbooks/wordpress/recipes/default.rb
  147. +5 −0 cookbooks/wordpress/templates/default/grants.sql.erb
  148. +26 −0 cookbooks/wordpress/templates/default/wordpress.conf.erb
  149. +76 −0 cookbooks/wordpress/templates/default/wp-config.php.erb
  150. +27 −0 cookbooks/xml/README.md
  151. +12 −0 cookbooks/xml/metadata.rb
  152. +25 −0 cookbooks/xml/recipes/default.rb
  153. 0 theme/.gitkeep
1 .gitignore
@@ -0,0 +1 @@
+.vagrant
4 Gemfile
@@ -0,0 +1,4 @@
+# A sample Gemfile
+source "http://rubygems.org"
+
+gem "vagrant"
33 Gemfile.lock
@@ -0,0 +1,33 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ archive-tar-minitar (0.5.2)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ ffi (1.0.9)
+ i18n (0.5.0)
+ json (1.5.1)
+ mario (0.0.6)
+ net-scp (1.0.4)
+ net-ssh (>= 1.99.1)
+ net-ssh (2.1.4)
+ thor (0.14.6)
+ vagrant (0.7.5)
+ archive-tar-minitar (= 0.5.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.5.0)
+ json (~> 1.5.1)
+ mario (~> 0.0.6)
+ net-scp (~> 1.0.4)
+ net-ssh (~> 2.1.0)
+ thor (~> 0.14.6)
+ virtualbox (~> 0.8.3)
+ virtualbox (0.8.6)
+ ffi (~> 1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ vagrant
26 Readme.md
@@ -0,0 +1,26 @@
+# Vagrant Wordpress Theming #
+
+This is a [Vagrant][vagrant] setup for creating Wordpress themes. Uses
+[Chef Solo][chef] recipes for provisioning. The recipes are copied from
+[my fork][cookbooks-developish] of [those by Opscode][cookbooks-opscode], which
+allows for their use with Chef Solo and for a blank MySQL root password.
+
+## Requirements ##
+
+* [Vagrant][vagrant]
+
+## To get started ##
+
+ $ git clone git://github.com/developish/vagrant-wordpress.git
+ $ cd vagrant-wordpress
+ $ vagrant up
+ $ open http://localhost:8080
+
+Copy a base theme (like [Starkers][starkers]) into the theme directory, choose
+it in the Wordpress dashboard, and get to work!
+
+[vagrant]:http://vagrantup.com
+[chef]:http://wiki.opscode.com/display/chef/Chef+Solo
+[cookbooks-developish]:https://github.com/opscode/cookbooks
+[cookbooks-opscode]:https://github.com/opscode/cookbooks
+[starkers]:http://starkerstheme.com
53 Vagrantfile
@@ -0,0 +1,53 @@
+Vagrant::Config.run do |config|
+ # All Vagrant configuration is done here. The most common configuration
+ # options are documented and commented below. For a complete reference,
+ # please see the online documentation at vagrantup.com.
+
+ # Every Vagrant virtual environment requires a box to build off of.
+ config.vm.box = "lucid32"
+
+ # The url from where the 'config.vm.box' box will be fetched if it
+ # doesn't already exist on the user's system.
+ config.vm.box_url = "http://files.vagrantup.com/lucid32.box"
+
+ # Boot with a GUI so you can see the screen. (Default is headless)
+ # config.vm.boot_mode = :gui
+
+ # Assign this VM to a host only network IP, allowing you to access it
+ # via the IP.
+ # config.vm.network "33.33.33.10"
+
+ # Forward a port from the guest to the host, which allows for outside
+ # computers to access the VM, whereas host only networking does not.
+ config.vm.forward_port "http", 80, 8080
+ config.vm.forward_port "mysql", 3306, 3306
+
+ # Share an additional folder to the guest VM. The first argument is
+ # an identifier, the second is the path on the guest to mount the
+ # folder, and the third is the path on the host to the actual folder.
+ config.vm.share_folder "theme", "/var/www/wordpress/wp-content/themes/theme",
+ "./theme"
+
+ # Enable provisioning with chef solo, specifying a cookbooks path (relative
+ # to this Vagrantfile), and adding some recipes and/or roles.
+ config.vm.provision :chef_solo do |chef|
+ chef.cookbooks_path = "cookbooks"
+ chef.add_recipe "apt"
+ chef.add_recipe "wordpress"
+
+ chef.json.merge!(
+ "mysql" => {
+ "server_root_password" => "",
+ "allow_remote_root" => true
+ },
+
+ "wordpress" => {
+ "db" => {
+ "database" => "wordpress",
+ "user" => "wordpress",
+ "password" => "wordpress"
+ }
+ }
+ )
+ end
+end
78 cookbooks/apache2/README.rdoc
@@ -0,0 +1,78 @@
+= DESCRIPTION:
+
+Complete Debian/Ubuntu style Apache2 configuration.
+
+= REQUIREMENTS:
+
+Debian or Ubuntu preferred.
+
+Red Hat, CentOS, Fedora and ArchLinux can be used but will be converted to a Debian/Ubuntu style Apache as it's far easier to manage with Chef.
+
+= ATTRIBUTES:
+
+The file attributes/apache.rb contains the following attribute types:
+
+* platform specific locations and settings.
+* general settings
+* prefork attributes
+* worker attributes
+
+General settings and prefork/worker attributes are tunable.
+
+= USAGE:
+
+Include the apache2 recipe to install Apache2 and get 'sane' default settings. Configuration is modularized through Apache vhost sites a la Debian style configuration.
+
+For Red Hat, CentOS and Fedora you should first disable selinux as it's not supported (yet), then remove the stock httpd and all it's dependencies prior to attempting to use this recipe. Many packages in these distributions drop conflicting configs into conf.d, all of which haven't been accounted for yet. Starting from scratch will also make it far easier to debug.
+
+== Defines:
+
+* +apache_module+: sets up an Apache module.
+* +apache_conf+: sets up a config file for an apache module.
+* +apache_site+: sets up a vhost site. The conf file must be available.
+* +web_app+: copies the template for a web app and enables it as a site via +apache_site+.
+
+== Web Apps:
+
+Various applications that can be set up with Apache as the front end, such as PHP, Django, Rails and others can use the web_app define to set up the template and the Apache site. The define is kind of dumb, so the template needs have the application implementation settings, since we don't know what your app is or what is needed from Apache.
+
+We only prototype one parameter for the +web_app+ define, "template". This is used to specify the name of the template to use in the current cookbook. When you use +web_app+, you can set up any parameters you want to use in your template. They will get passed to the template through the params hash. For example, the sample +web_app.conf.erb+ template in this cookbook makes use of these.
+
+* +docroot+
+* +server_name+
+* +server_aliases+
+
+These are available as +params[:docroot]+, +params[:server_name]+, +params[:server_aliases]+ prefixed with an @ within the template.
+
+If 'cookbook' and 'template' are not specified, the current cookbook's +templates/default/web_app.conf.erb+ will be used. If this template is not suitable for your application, copy it to your cookbook and customize as needed.
+
+== God Monitor:
+
+There's a new recipe, +apache2::god_monitor+. You will need to make sure to include the 'god' recipe before using the +apache2::god_monitor+ recipe in your cookbook.
+
+== OpenID Auth
+
+Installs the +mod_auth_openid+ module from source. Specify an array of OpenIDs that are allowed to authenticate with the attribute +apache[:allowed_openids]+. Use the following in a vhost to protect with OpenID authentication:
+
+ AuthOpenIDEnabled On
+ AuthOpenIDDBLocation /var/cache/apache2/mod_auth_openid.db
+ AuthOpenIDUserProgram /usr/local/bin/mod_auth_openid.rb
+
+Change the DBLocation as appropriate for your platform. You'll need to change the file in the recipe to match. The UserProgram is optional if you don't want to limit access by certain OpenIDs.
+
+= LICENSE & AUTHOR:
+
+Author:: Joshua Timberman (<joshua@opscode.com>)
+Copyright:: 2009, Opscode, Inc
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
87 cookbooks/apache2/attributes/default.rb
@@ -0,0 +1,87 @@
+#
+# Cookbook Name:: apache2
+# Attributes:: apache
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Where the various parts of apache are
+case platform
+when "redhat","centos","fedora","suse"
+ set[:apache][:dir] = "/etc/httpd"
+ set[:apache][:log_dir] = "/var/log/httpd"
+ set[:apache][:user] = "apache"
+ set[:apache][:binary] = "/usr/sbin/httpd"
+ set[:apache][:icondir] = "/var/www/icons/"
+ set[:apache][:cache_dir] = "/var/cache/httpd"
+when "debian","ubuntu"
+ set[:apache][:dir] = "/etc/apache2"
+ set[:apache][:log_dir] = "/var/log/apache2"
+ set[:apache][:user] = "www-data"
+ set[:apache][:binary] = "/usr/sbin/apache2"
+ set[:apache][:icondir] = "/usr/share/apache2/icons"
+ set[:apache][:cache_dir] = "/var/cache/apache2"
+when "arch"
+ set[:apache][:dir] = "/etc/httpd"
+ set[:apache][:log_dir] = "/var/log/httpd"
+ set[:apache][:user] = "http"
+ set[:apache][:binary] = "/usr/sbin/httpd"
+ set[:apache][:icondir] = "/usr/share/httpd/icons"
+ set[:apache][:cache_dir] = "/var/cache/httpd"
+else
+ set[:apache][:dir] = "/etc/apache2"
+ set[:apache][:log_dir] = "/var/log/apache2"
+ set[:apache][:user] = "www-data"
+ set[:apache][:binary] = "/usr/sbin/apache2"
+ set[:apache][:icondir] = "/usr/share/apache2/icons"
+ set[:apache][:cache_dir] = "/var/cache/apache2"
+end
+
+###
+# These settings need the unless, since we want them to be tunable,
+# and we don't want to override the tunings.
+###
+
+# General settings
+default[:apache][:listen_ports] = [ "80","443" ]
+default[:apache][:contact] = "ops@example.com"
+default[:apache][:timeout] = 300
+default[:apache][:keepalive] = "On"
+default[:apache][:keepaliverequests] = 100
+default[:apache][:keepalivetimeout] = 5
+
+# Security
+default[:apache][:servertokens] = "Prod"
+default[:apache][:serversignature] = "On"
+default[:apache][:traceenable] = "On"
+
+# mod_auth_openids
+default[:apache][:allowed_openids] = Array.new
+
+# Prefork Attributes
+default[:apache][:prefork][:startservers] = 16
+default[:apache][:prefork][:minspareservers] = 16
+default[:apache][:prefork][:maxspareservers] = 32
+default[:apache][:prefork][:serverlimit] = 400
+default[:apache][:prefork][:maxclients] = 400
+default[:apache][:prefork][:maxrequestsperchild] = 10000
+
+# Worker Attributes
+default[:apache][:worker][:startservers] = 4
+default[:apache][:worker][:maxclients] = 1024
+default[:apache][:worker][:minsparethreads] = 64
+default[:apache][:worker][:maxsparethreads] = 192
+default[:apache][:worker][:threadsperchild] = 64
+default[:apache][:worker][:maxrequestsperchild] = 0
26 cookbooks/apache2/definitions/apache_conf.rb
@@ -0,0 +1,26 @@
+#
+# Cookbook Name:: apache2
+# Definition:: apache_conf
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+define :apache_conf do
+ template "#{node[:apache][:dir]}/mods-available/#{params[:name]}.conf" do
+ source "mods/#{params[:name]}.conf.erb"
+ notifies :restart, resources(:service => "apache2")
+ mode 0644
+ end
+end
43 cookbooks/apache2/definitions/apache_module.rb
@@ -0,0 +1,43 @@
+#
+# Cookbook Name:: apache2
+# Definition:: apache_module
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+define :apache_module, :enable => true, :conf => false do
+ include_recipe "apache2"
+
+ if params[:conf]
+ apache_conf params[:name]
+ end
+
+ if params[:enable]
+ execute "a2enmod #{params[:name]}" do
+ command "/usr/sbin/a2enmod #{params[:name]}"
+ notifies :restart, resources(:service => "apache2")
+ not_if do (File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.load") and
+ ((File.exists?("#{node[:apache][:dir]}/mods-available/#{params[:name]}.conf"))?
+ (File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.conf")):(true)))
+ end
+ end
+ else
+ execute "a2dismod #{params[:name]}" do
+ command "/usr/sbin/a2dismod #{params[:name]}"
+ notifies :restart, resources(:service => "apache2")
+ only_if do ::File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.load") end
+ end
+ end
+end
40 cookbooks/apache2/definitions/apache_site.rb
@@ -0,0 +1,40 @@
+#
+# Cookbook Name:: apache2
+# Definition:: apache_site
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+define :apache_site, :enable => true do
+ include_recipe "apache2"
+
+ if params[:enable]
+ execute "a2ensite #{params[:name]}" do
+ command "/usr/sbin/a2ensite #{params[:name]}"
+ notifies :restart, resources(:service => "apache2")
+ not_if do
+ ::File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") or
+ ::File.symlink?("#{node[:apache][:dir]}/sites-enabled/000-#{params[:name]}")
+ end
+ only_if do ::File.exists?("#{node[:apache][:dir]}/sites-available/#{params[:name]}") end
+ end
+ else
+ execute "a2dissite #{params[:name]}" do
+ command "/usr/sbin/a2dissite #{params[:name]}"
+ notifies :restart, resources(:service => "apache2")
+ only_if do ::File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") end
+ end
+ end
+end
49 cookbooks/apache2/definitions/web_app.rb
@@ -0,0 +1,49 @@
+#
+# Cookbook Name:: apache2
+# Definition:: web_app
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+define :web_app, :template => "web_app.conf.erb" do
+
+ application_name = params[:name]
+
+ include_recipe "apache2"
+ include_recipe "apache2::mod_rewrite"
+ include_recipe "apache2::mod_deflate"
+ include_recipe "apache2::mod_headers"
+
+ template "#{node[:apache][:dir]}/sites-available/#{application_name}.conf" do
+ source params[:template]
+ owner "root"
+ group "root"
+ mode 0644
+ if params[:cookbook]
+ cookbook params[:cookbook]
+ end
+ variables(
+ :application_name => application_name,
+ :params => params
+ )
+ if ::File.exists?("#{node[:apache][:dir]}/sites-enabled/#{application_name}.conf")
+ notifies :reload, resources(:service => "apache2"), :delayed
+ end
+ end
+
+ apache_site "#{params[:name]}.conf" do
+ enable enable_setting
+ end
+end
41 cookbooks/apache2/files/default/apache2_module_conf_generate.pl
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+=begin
+
+Generates Ubuntu style module.load files.
+
+./apache2_module_conf_generate.pl /usr/lib64/httpd/modules /etc/httpd/mods-available
+
+ARGV[0] is the apache modules directory, ARGV[1] is where you want 'em.
+
+=cut
+
+use File::Find;
+
+use strict;
+use warnings;
+
+die "Must have '/path/to/modules' and '/path/to/modules.load'"
+ unless $ARGV[0] && $ARGV[1];
+
+find(
+ {
+ wanted => sub {
+ return 1 if $File::Find::name !~ /\.so$/;
+ my $modfile = $_;
+ $modfile =~ /(lib|mod_)(.+)\.so$/;
+ my $modname = $2;
+ my $filename = "$ARGV[1]/$modname.load";
+ unless ( -f $filename ) {
+ open( FILE, ">", $filename ) or die "Cannot open $filename";
+ print FILE "LoadModule " . $modname . "_module $File::Find::name\n";
+ close(FILE);
+ }
+ },
+ follow => 1,
+ },
+ $ARGV[0]
+);
+
+exit 0;
+
197 cookbooks/apache2/metadata.rb
@@ -0,0 +1,197 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+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'))
+version "0.99.4"
+recipe "apache2", "Main Apache configuration"
+recipe "apache2::mod_alias", "Apache module 'alias' with config file"
+recipe "apache2::mod_auth_basic", "Apache module 'auth_basic'"
+recipe "apache2::mod_auth_digest", "Apache module 'auth_digest'"
+recipe "apache2::mod_auth_openid", "Apache module 'authopenid'"
+recipe "apache2::mod_authn_file", "Apache module 'authn_file'"
+recipe "apache2::mod_authnz_ldap", "Apache module 'authnz_ldap'"
+recipe "apache2::mod_authz_default", "Apache module 'authz_default'"
+recipe "apache2::mod_authz_groupfile", "Apache module 'authz_groupfile'"
+recipe "apache2::mod_authz_host", "Apache module 'authz_host'"
+recipe "apache2::mod_authz_user", "Apache module 'authz_user'"
+recipe "apache2::mod_autoindex", "Apache module 'autoindex' with config file"
+recipe "apache2::mod_cgi", "Apache module 'cgi'"
+recipe "apache2::mod_dav", "Apache module 'dav'"
+recipe "apache2::mod_dav_svn", "Apache module 'dav_svn'"
+recipe "apache2::mod_deflate", "Apache module 'deflate' with config file"
+recipe "apache2::mod_dir", "Apache module 'dir' with config file"
+recipe "apache2::mod_env", "Apache module 'env'"
+recipe "apache2::mod_expires", "Apache module 'expires'"
+recipe "apache2::mod_fcgid", "Apache module 'fcgid', package on ubuntu/debian, rhel/centos, compile source on suse; with config file"
+recipe "apache2::mod_headers", "Apache module 'headers'"
+recipe "apache2::mod_ldap", "Apache module 'ldap'"
+recipe "apache2::mod_log_config", "Apache module 'log_config'"
+recipe "apache2::mod_mime", "Apache module 'mime' with config file"
+recipe "apache2::mod_negotiation", "Apache module 'negotiation' with config file"
+recipe "apache2::mod_php5", "Apache module 'php5'"
+recipe "apache2::mod_proxy", "Apache module 'proxy' with config file"
+recipe "apache2::mod_proxy_ajp", "Apache module 'proxy_ajp'"
+recipe "apache2::mod_proxy_balancer", "Apache module 'proxy_balancer'"
+recipe "apache2::mod_proxy_connect", "Apache module 'proxy_connect'"
+recipe "apache2::mod_proxy_http", "Apache module 'proxy_http'"
+recipe "apache2::mod_python", "Apache module 'python'"
+recipe "apache2::mod_rewrite", "Apache module 'rewrite'"
+recipe "apache2::mod_setenvif", "Apache module 'setenvif' with config file"
+recipe "apache2::mod_ssl", "Apache module 'ssl' with config file, adds port 443 to listen_ports"
+recipe "apache2::mod_status", "Apache module 'status' with config file"
+
+%w{redhat centos debian ubuntu arch}.each do |os|
+ supports os
+end
+
+attribute "apache",
+ :display_name => "Apache Hash",
+ :description => "Hash of Apache attributes",
+ :type => "hash"
+
+attribute "apache/dir",
+ :display_name => "Apache Directory",
+ :description => "Location for Apache configuration",
+ :default => "/etc/apache2"
+
+attribute "apache/log_dir",
+ :display_name => "Apache Log Directory",
+ :description => "Location for Apache logs",
+ :default => "/etc/apache2"
+
+attribute "apache/user",
+ :display_name => "Apache User",
+ :description => "User Apache runs as",
+ :default => "www-data"
+
+attribute "apache/binary",
+ :display_name => "Apache Binary",
+ :description => "Apache server daemon program",
+ :default => "/usr/sbin/apache2"
+
+attribute "apache/icondir",
+ :display_name => "Apache Icondir",
+ :description => "Directory location for icons",
+ :default => "/usr/share/apache2/icons"
+
+attribute "apache/listen_ports",
+ :display_name => "Apache Listen Ports",
+ :description => "Ports that Apache should listen on",
+ :type => "array",
+ :default => [ "80", "443" ]
+
+attribute "apache/contact",
+ :display_name => "Apache Contact",
+ :description => "Email address of webmaster",
+ :default => "ops@example.com"
+
+attribute "apache/timeout",
+ :display_name => "Apache Timeout",
+ :description => "Connection timeout value",
+ :default => "300"
+
+attribute "apache/keepalive",
+ :display_name => "Apache Keepalive",
+ :description => "HTTP persistent connections",
+ :default => "On"
+
+attribute "apache/keepaliverequests",
+ :display_name => "Apache Keepalive Requests",
+ :description => "Number of requests allowed on a persistent connection",
+ :default => "100"
+
+attribute "apache/keepalivetimeout",
+ :display_name => "Apache Keepalive Timeout",
+ :description => "Time to wait for requests on persistent connection",
+ :default => "5"
+
+attribute "apache/servertokens",
+ :display_name => "Apache Server Tokens",
+ :description => "Server response header",
+ :default => "Prod"
+
+attribute "apache/serversignature",
+ :display_name => "Apache Server Signature",
+ :description => "Configure footer on server-generated documents",
+ :default => "On"
+
+attribute "apache/traceenable",
+ :display_name => "Apache Trace Enable",
+ :description => "Determine behavior of TRACE requests",
+ :default => "On"
+
+attribute "apache/allowed_openids",
+ :display_name => "Apache Allowed OpenIDs",
+ :description => "Array of OpenIDs allowed to authenticate",
+ :default => ""
+
+attribute "apache/prefork",
+ :display_name => "Apache Prefork",
+ :description => "Hash of Apache prefork tuning attributes.",
+ :type => "hash"
+
+attribute "apache/prefork/startservers",
+ :display_name => "Apache Prefork MPM StartServers",
+ :description => "Number of MPM servers to start",
+ :default => "16"
+
+attribute "apache/prefork/minspareservers",
+ :display_name => "Apache Prefork MPM MinSpareServers",
+ :description => "Minimum number of spare server processes",
+ :default => "16"
+
+attribute "apache/prefork/maxspareservers",
+ :display_name => "Apache Prefork MPM MaxSpareServers",
+ :description => "Maximum number of spare server processes",
+ :default => "32"
+
+attribute "apache/prefork/serverlimit",
+ :display_name => "Apache Prefork MPM ServerLimit",
+ :description => "Upper limit on configurable server processes",
+ :default => "400"
+
+attribute "apache/prefork/maxclients",
+ :display_name => "Apache Prefork MPM MaxClients",
+ :description => "Maximum number of simultaneous connections",
+ :default => "400"
+
+attribute "apache/prefork/maxrequestsperchild",
+ :display_name => "Apache Prefork MPM MaxRequestsPerChild",
+ :description => "Maximum number of request a child process will handle",
+ :default => "10000"
+
+attribute "apache/worker",
+ :display_name => "Apache Worker",
+ :description => "Hash of Apache prefork tuning attributes.",
+ :type => "hash"
+
+attribute "apache/worker/startservers",
+ :display_name => "Apache Worker MPM StartServers",
+ :description => "Initial number of server processes to start",
+ :default => "4"
+
+attribute "apache/worker/maxclients",
+ :display_name => "Apache Worker MPM MaxClients",
+ :description => "Maximum number of simultaneous connections",
+ :default => "1024"
+
+attribute "apache/worker/minsparethreads",
+ :display_name => "Apache Worker MPM MinSpareThreads",
+ :description => "Minimum number of spare worker threads",
+ :default => "64"
+
+attribute "apache/worker/maxsparethreads",
+ :display_name => "Apache Worker MPM MaxSpareThreads",
+ :description => "Maximum number of spare worker threads",
+ :default => "192"
+
+attribute "apache/worker/threadsperchild",
+ :display_name => "Apache Worker MPM ThreadsPerChild",
+ :description => "Constant number of worker threads in each server process",
+ :default => "64"
+
+attribute "apache/worker/maxrequestsperchild",
+ :display_name => "Apache Worker MPM MaxRequestsPerChild",
+ :description => "Maximum number of request a child process will handle",
+ :default => "0"
209 cookbooks/apache2/recipes/default.rb
@@ -0,0 +1,209 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package "apache2" do
+ case node[:platform]
+ when "centos","redhat","fedora","suse"
+ package_name "httpd"
+ when "debian","ubuntu"
+ package_name "apache2"
+ when "arch"
+ package_name "apache"
+ end
+ action :install
+end
+
+service "apache2" do
+ case node[:platform]
+ when "centos","redhat","fedora","suse"
+ 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 "debian","ubuntu"
+ service_name "apache2"
+ restart_command "/usr/sbin/invoke-rc.d apache2 restart && sleep 1"
+ reload_command "/usr/sbin/invoke-rc.d apache2 reload && sleep 1"
+ when "arch"
+ service_name "httpd"
+ end
+ supports value_for_platform(
+ "debian" => { "4.0" => [ :restart, :reload ], "default" => [ :restart, :reload, :status ] },
+ "ubuntu" => { "default" => [ :restart, :reload, :status ] },
+ "centos" => { "default" => [ :restart, :reload, :status ] },
+ "redhat" => { "default" => [ :restart, :reload, :status ] },
+ "fedora" => { "default" => [ :restart, :reload, :status ] },
+ "arch" => { "default" => [ :restart, :reload, :status ] },
+ "default" => { "default" => [:restart, :reload ] }
+ )
+ action :enable
+end
+
+if platform?("centos", "redhat", "fedora", "suse", "arch")
+ directory node[:apache][:log_dir] do
+ mode 0755
+ action :create
+ end
+
+ cookbook_file "/usr/local/bin/apache2_module_conf_generate.pl" do
+ source "apache2_module_conf_generate.pl"
+ mode 0755
+ owner "root"
+ group "root"
+ end
+
+ %w{sites-available sites-enabled mods-available mods-enabled}.each do |dir|
+ directory "#{node[:apache][:dir]}/#{dir}" do
+ mode 0755
+ owner "root"
+ group "root"
+ action :create
+ end
+ end
+
+ execute "generate-module-list" do
+ if node[:kernel][:machine] == "x86_64"
+ libdir = value_for_platform("arch" => { "default" => "lib" }, "default" => "lib64")
+ else
+ libdir = "lib"
+ end
+ command "/usr/local/bin/apache2_module_conf_generate.pl /usr/#{libdir}/httpd/modules /etc/httpd/mods-available"
+ action :run
+ end
+
+ %w{a2ensite a2dissite a2enmod a2dismod}.each do |modscript|
+ template "/usr/sbin/#{modscript}" do
+ source "#{modscript}.erb"
+ mode 0755
+ owner "root"
+ group "root"
+ end
+ end
+
+ # installed by default on centos/rhel, remove in favour of mods-enabled
+ file "#{node[:apache][:dir]}/conf.d/proxy_ajp.conf" do
+ action :delete
+ backup false
+ end
+ file "#{node[:apache][:dir]}/conf.d/README" do
+ action :delete
+ backup false
+ end
+
+ # welcome page moved to the default-site.rb temlate
+ file "#{node[:apache][:dir]}/conf.d/welcome.conf" do
+ action :delete
+ backup false
+ end
+end
+
+directory "#{node[:apache][:dir]}/ssl" do
+ action :create
+ mode 0755
+ owner "root"
+ group "root"
+end
+
+directory "#{node[:apache][:dir]}/conf.d" do
+ action :create
+ mode 0755
+ owner "root"
+ group "root"
+end
+
+directory node[:apache][:cache_dir] do
+ action :create
+ mode 0755
+ owner node[:apache][:user]
+end
+
+template "apache2.conf" do
+ case node[:platform]
+ when "centos","redhat","fedora","arch"
+ path "#{node[:apache][:dir]}/conf/httpd.conf"
+ when "debian","ubuntu"
+ path "#{node[:apache][:dir]}/apache2.conf"
+ end
+ source "apache2.conf.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ notifies :restart, resources(:service => "apache2")
+end
+
+template "security" do
+ path "#{node[:apache][:dir]}/conf.d/security"
+ source "security.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ backup false
+ notifies :restart, resources(:service => "apache2")
+end
+
+template "charset" do
+ path "#{node[:apache][:dir]}/conf.d/charset"
+ source "charset.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ backup false
+ notifies :restart, resources(:service => "apache2")
+end
+
+template "#{node[:apache][:dir]}/ports.conf" do
+ source "ports.conf.erb"
+ group "root"
+ owner "root"
+ variables :apache_listen_ports => node[:apache][:listen_ports]
+ mode 0644
+ notifies :restart, resources(:service => "apache2")
+end
+
+template "#{node[:apache][:dir]}/sites-available/default" do
+ source "default-site.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ notifies :restart, resources(:service => "apache2")
+end
+
+include_recipe "apache2::mod_status"
+include_recipe "apache2::mod_alias"
+include_recipe "apache2::mod_auth_basic"
+include_recipe "apache2::mod_authn_file"
+include_recipe "apache2::mod_authz_default"
+include_recipe "apache2::mod_authz_groupfile"
+include_recipe "apache2::mod_authz_host"
+include_recipe "apache2::mod_authz_user"
+include_recipe "apache2::mod_autoindex"
+include_recipe "apache2::mod_dir"
+include_recipe "apache2::mod_env"
+include_recipe "apache2::mod_mime"
+include_recipe "apache2::mod_negotiation"
+include_recipe "apache2::mod_setenvif"
+include_recipe "apache2::mod_log_config" if platform?("centos", "redhat", "fedora", "suse", "arch")
+
+apache_site "default" if platform?("centos", "redhat", "fedora")
+
+service "apache2" do
+ action :start
+end
33 cookbooks/apache2/recipes/god_monitor.rb
@@ -0,0 +1,33 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: god_monitor
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_service = service "apache2" do
+ action :nothing
+end
+
+start_command = apache_service.start_command
+stop_command = apache_service.stop_command
+restart_command = apache_service.restart_command
+
+god_monitor "apache2" do
+ config "apache2.god.erb"
+ start (start_command)?start_command : "/etc/init.d/#{apache_service.service_name} start"
+ restart (restart_command)?restart_command : "/etc/init.d/#{apache_service.service_name} restart"
+ stop (stop_command)?stop_command : "/etc/init.d/#{apache_service.service_name} stop"
+end
22 cookbooks/apache2/recipes/mod_alias.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: alias
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "alias" do
+ conf true
+end
20 cookbooks/apache2/recipes/mod_auth_basic.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: auth_basic
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "auth_basic"
20 cookbooks/apache2/recipes/mod_auth_digest.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: auth_digest
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "auth_digest"
83 cookbooks/apache2/recipes/mod_auth_openid.rb
@@ -0,0 +1,83 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: mod_auth_openid
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+openid_dev_pkgs = value_for_platform(
+ "ubuntu" => { "default" => %w{ apache2-prefork-dev libopkele-dev libopkele3 } },
+ "debian" => { "default" => %w{ apache2-prefork-dev libopkele-dev libopkele3 } },
+ "arch" => { "default" => ["libopkele"] }
+)
+
+case node[:platform]
+when "arch"
+ include_recipe "pacman"
+ package "tidyhtml"
+end
+
+openid_dev_pkgs.each do |pkg|
+ case node[:platform]
+ when "arch"
+ pacman_aur pkg do
+ action [:build, :install]
+ end
+ else
+ package pkg
+ end
+end
+
+remote_file "#{Chef::Config[:file_cache_path]}/mod_auth_openid-0.4.tar.gz" do
+ source "http://butterfat.net/releases/mod_auth_openid/mod_auth_openid-0.4.tar.gz"
+ mode 0644
+end
+
+bash "install mod_auth_openid" do
+ cwd Chef::Config[:file_cache_path]
+ code <<-EOH
+ tar zxvf mod_auth_openid-0.4.tar.gz
+ cd mod_auth_openid-0.4 && ./configure
+ perl -pi -e "s/-i -a -n 'authopenid'/-i -n 'authopenid'/g" Makefile
+ make && make install
+ EOH
+ case node[:platform]
+ when "arch"
+ not_if { ::File.exists?("/usr/lib/httpd/modules/mod_auth_openid.so") }
+ else
+ not_if { ::File.exists?("/usr/lib/apache2/modules/mod_auth_openid.so") }
+ end
+end
+
+file "#{node[:apache][:cache_dir]}/mod_auth_openid.db" do
+ owner node[:apache][:user]
+ mode 0640
+end
+
+template "#{node[:apache][:dir]}/mods-available/authopenid.load" do
+ source "mods/authopenid.load.erb"
+ owner "root"
+ group "root"
+ mode 0644
+end
+
+apache_module "authopenid"
+
+template "/usr/local/bin/mod_auth_openid.rb" do
+ source "mod_auth_openid.rb.erb"
+ owner node[:apache][:user]
+ group node[:apache][:user]
+ mode 0750
+end
20 cookbooks/apache2/recipes/mod_authn_file.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authn_file
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authn_file"
20 cookbooks/apache2/recipes/mod_authnz_ldap.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authnz_ldap
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authnz_ldap"
20 cookbooks/apache2/recipes/mod_authz_default.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authz_default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authz_default"
20 cookbooks/apache2/recipes/mod_authz_groupfile.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authz_groupfile
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authz_groupfile"
20 cookbooks/apache2/recipes/mod_authz_host.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authz_host
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authz_host"
20 cookbooks/apache2/recipes/mod_authz_user.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authz_user
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authz_user"
22 cookbooks/apache2/recipes/mod_autoindex.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: autoindex
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "autoindex" do
+ conf true
+end
20 cookbooks/apache2/recipes/mod_cgi.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: cgi
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "cgi"
20 cookbooks/apache2/recipes/mod_dav.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: dav
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "dav"
22 cookbooks/apache2/recipes/mod_dav_svn.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: dav_svn
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package "libapache2-svn"
+
+apache_module "dav_svn"
22 cookbooks/apache2/recipes/mod_deflate.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: deflate
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "deflate" do
+ conf true
+end
22 cookbooks/apache2/recipes/mod_dir.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: dir
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "dir" do
+ conf true
+end
20 cookbooks/apache2/recipes/mod_env.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: env
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "env"
20 cookbooks/apache2/recipes/mod_expires.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: expires
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "expires"
46 cookbooks/apache2/recipes/mod_fcgid.rb
@@ -0,0 +1,46 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: fcgid
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if platform?("debian", "ubuntu")
+ package "libapache2-mod-fcgid"
+elsif platform?("centos", "redhat", "fedora", "arch")
+ package "mod_fcgid" do
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+
+ file "#{node[:apache][:dir]}/conf.d/fcgid.conf" do
+ action :delete
+ backup false
+ end
+elsif platform?("suse")
+ apache_lib_path = node[:architecture] == "i386" ? "/usr/lib/httpd" : "/usr/lib64/httpd"
+ package "httpd-devel"
+ bash "install-fcgid" do
+ code <<-EOH
+(cd #{Chef::Config[:file_cache_path]}; wget http://superb-east.dl.sourceforge.net/sourceforge/mod-fcgid/mod_fcgid.2.2.tgz)
+(cd #{Chef::Config[:file_cache_path]}; tar zxvf mod_fcgid.2.2.tgz)
+(cd #{Chef::Config[:file_cache_path]}; perl -pi -e 's!/usr/local/apache2!#{apache_lib_path}!g' ./mod_fcgid.2.2/Makefile)
+(cd #{Chef::Config[:file_cache_path]}/mod_fcgid.2.2; make install)
+EOH
+ end
+end
+
+apache_module "fcgid" do
+ conf true
+end
20 cookbooks/apache2/recipes/mod_headers.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: headers
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "headers"
20 cookbooks/apache2/recipes/mod_ldap.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: ldap
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "ldap"
24 cookbooks/apache2/recipes/mod_log_config.rb
@@ -0,0 +1,24 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: log_config
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if platform?("centos", "redhat", "fedora", "suse", "arch")
+ apache_module "log_config"
+else
+ include_recipe "apache2"
+end
22 cookbooks/apache2/recipes/mod_mime.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: mime
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "mime" do
+ conf true
+end
22 cookbooks/apache2/recipes/mod_negotiation.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: negotiation
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "negotiation" do
+ conf true
+end
37 cookbooks/apache2/recipes/mod_php5.rb
@@ -0,0 +1,37 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: php5
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:platform]
+when "debian", "ubuntu"
+ package "libapache2-mod-php5" do
+ action :install
+ end
+when "arch"
+ package "php-apache" do
+ action :install
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+when "centos", "redhat", "fedora"
+ package "php53" do
+ action :install
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+end
+
+apache_module "php5"
22 cookbooks/apache2/recipes/mod_proxy.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy" do
+ conf true
+end
20 cookbooks/apache2/recipes/mod_proxy_ajp.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy_ajp"
20 cookbooks/apache2/recipes/mod_proxy_balancer.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy_balancer"
20 cookbooks/apache2/recipes/mod_proxy_connect.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy_connect"
20 cookbooks/apache2/recipes/mod_proxy_http.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy_http
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy_http"
32 cookbooks/apache2/recipes/mod_python.rb
@@ -0,0 +1,32 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: python
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:platform]
+ when "debian", "ubuntu"
+ package "libapache2-mod-python" do
+ action :install
+ end
+ when "centos", "redhat", "fedora"
+ package "mod_python" do
+ action :install
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+end
+
+apache_module "python"
20 cookbooks/apache2/recipes/mod_rewrite.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: rewrite
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "rewrite"
22 cookbooks/apache2/recipes/mod_setenvif.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: setenvif
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "setenvif" do
+ conf true
+end
43 cookbooks/apache2/recipes/mod_ssl.rb
@@ -0,0 +1,43 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: ssl
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if platform?("centos", "redhat", "fedora")
+ package "mod_ssl" do
+ action :install
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+
+ file "#{node[:apache][:dir]}/conf.d/ssl.conf" do
+ action :delete
+ backup false
+ end
+end
+
+ports = node[:apache][:listen_ports].include?("443") ? node[:apache][:listen_ports] : [node[:apache][:listen_ports], "443"].flatten
+
+template "#{node[:apache][:dir]}/ports.conf" do
+ source "ports.conf.erb"
+ variables :apache_listen_ports => ports
+ notifies :restart, resources(:service => "apache2")
+ mode 0644
+end
+
+apache_module "ssl" do
+ conf true
+end
22 cookbooks/apache2/recipes/mod_status.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: status
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "status" do
+ conf true
+end
27 cookbooks/apache2/recipes/mod_wsgi.rb
@@ -0,0 +1,27 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: python
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:platform]
+when "debian","ubuntu"
+ package "libapache2-mod-wsgi"
+when "redhat","centos","fedora", "arch"
+ package "mod_wsgi"
+end
+
+apache_module "wsgi"
22 cookbooks/apache2/templates/default/a2dismod.erb
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+
+SYSCONFDIR='<%= node[:apache][:dir] %>'
+
+if [ -z $1 ]; then
+ echo "Which module would you like to disable?"
+ echo -n "Your choices are: "
+ ls $SYSCONFDIR/mods-enabled/*.load | \
+ sed -e "s,$SYSCONFDIR/mods-enabled/,,g" | sed -e 's/\.load$//g;' | xargs echo
+ echo -n "Module name? "
+ read MODNAME
+else
+ MODNAME=$1
+fi
+
+if ! [ -e $SYSCONFDIR/mods-enabled/$MODNAME.load ]; then
+ echo "This module is already disabled, or does not exist!"
+ exit 1
+fi
+
+rm -f $SYSCONFDIR/mods-enabled/$MODNAME.*
+echo "Module $MODNAME disabled; reload apache to fully disable."
29 cookbooks/apache2/templates/default/a2dissite.erb
@@ -0,0 +1,29 @@
+#!/bin/sh -e
+
+SYSCONFDIR='<%= node[:apache][:dir] %>'
+
+if [ -z $1 ]; then
+ echo "Which site would you like to disable?"
+ echo -n "Your choices are: "
+ ls $node[:apache][:dir]/sites-enabled/* | \
+ sed -e "s,$SYSCONFDIR/sites-enabled/,,g" | xargs echo
+ echo -n "Site name? "
+ read SITENAME
+else
+ SITENAME=$1
+fi
+
+if [ $SITENAME = "default" ]; then
+ PRIORITY="000"
+fi
+
+if ! [ -e $SYSCONFDIR/sites-enabled/$SITENAME -o \
+ -e $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" ]; then
+ echo "This site is already disabled, or does not exist!"
+ exit 1
+fi
+
+if ! rm $SYSCONFDIR/sites-enabled/$SITENAME 2>/dev/null; then
+ rm -f $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME"
+fi
+echo "Site $SITENAME disabled; reload apache to disable."
37 cookbooks/apache2/templates/default/a2enmod.erb
@@ -0,0 +1,37 @@
+#!/bin/sh -e
+
+SYSCONFDIR='<%= node[:apache][:dir] %>'
+
+if [ -z $1 ]; then
+ echo "Which module would you like to enable?"
+ echo -n "Your choices are: "
+ ls $SYSCONFDIR/mods-available/*.load | \
+ sed -e "s,$SYSCONFDIR/mods-available/,,g" | sed -e 's/\.load$//g;