Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[COOK-822] - attribute to specify modules to enable via include_recipe

  • Loading branch information...
commit a824258720d930cb464d3a2af124f13f5af367db 1 parent 5dc3d3f
@jtimberman jtimberman authored
View
5 README.md
@@ -107,6 +107,9 @@ These are general settings used in recipes and templates. Default values are not
* `node['apache']['keepalive']` - Value for the KeepAlive directive. Default is On.
* `node['apache']['keepaliverequests']` - Value for MaxKeepAliveRequests. Default is 100.
* `node['apache']['keepalivetimeout']` - Value for the KeepAliveTimeout directive. Default is 5.
+* `node['apache']['default_modules']` - Array of module names. Can take "mod_FOO" or "FOO" as names, where FOO is the apache module, e.g. "`mod_status`" or "`status`".
+
+The modules listed in `default_modules` will be included as recipes in `recipe[apache::default]`.
Prefork attributes
------------------
@@ -154,7 +157,7 @@ On RHEL Family distributions, certain modules ship with a config file with the p
default
-------
-The default recipe does a number of things to set up Apache HTTPd.
+The default recipe does a number of things to set up Apache HTTPd. It also includes a number of modules based on the attribute `node['apache']['default_modules']` as recipes.
mod\_auth\_openid
-----------------
View
9 attributes/default.rb
@@ -118,3 +118,12 @@
default[:apache][:worker][:maxsparethreads] = 192
default[:apache][:worker][:threadsperchild] = 64
default[:apache][:worker][:maxrequestsperchild] = 0
+
+# Default modules to enable via include_recipe
+
+default['apache']['default_modules'] = %w{
+ status alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex
+ dir env mime negotiation setenvif
+}
+
+default['apache']['default_modules'] << "log_config" if node.platform?("redhat", "centos", "scientific", "fedora", "suse", "arch", "freebsd")
View
5 metadata.rb
@@ -196,3 +196,8 @@
:display_name => "Apache Worker MPM MaxRequestsPerChild",
:description => "Maximum number of request a child process will handle",
:default => "0"
+
+attribute "apache/default_modules",
+ :display_name => "Apache Default Modules",
+ :description => "Default modules to enable via recipes",
+ :default => "status alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex dir env mime negotiation setenvif"
View
19 recipes/default.rb
@@ -207,21 +207,10 @@
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?("redhat", "centos", "scientific", "fedora", "suse", "arch", "freebsd")
+node['apache']['default_modules'].each do |mod|
+ recipe_name = mod =~ /^mod_/ ? mod : "mod_#{mod}"
+ include_recipe "apache2::#{recipe_name}"
+end
apache_site "default" if platform?("redhat", "centos", "scientific", "fedora")
Please sign in to comment.
Something went wrong with that request. Please try again.