Skip to content

Instantly share code, notes, and snippets.

@behemphi
Created April 16, 2013 18:15
Show Gist options
  • Save behemphi/5398194 to your computer and use it in GitHub Desktop.
Save behemphi/5398194 to your computer and use it in GitHub Desktop.
case (Integer((node[:memory][:total]).sub('kB','')) / 1024)
when 0..900
config_bag = 'webserver_512mb'
when 901..1500
config_bag = 'webserver_1024mb'
when 1501..2500
config_bag = 'webserver_2048mb'
else
config_bag = 'webserver_2048mb'
log("no config file exists for a server of this size.") { level :warn }
end
config_parameters = data_bag_item('apache_configs',config_bag)
template "/tmp/apache2.conf" do
source "apache2.conf.erb"
mode "0644"
variables(
:ServerName => config_parameters["apache"]["ServerName"],
:StartServers => config_parameters["apache"]["StartServers"],
:MinSpareThreads => config_parameters["apache"]["MinSpareThreads"],
:MaxSpareThreads => config_parameters["apache"]["MaxSpareThreads"],
:ThreadLimit => config_parameters["apache"]["ThreadLimit"],
:ThreadsPerChild => config_parameters["apache"]["ThreadsPerChild"],
:MaxClients => config_parameters["apache"]["MaxClients"],
:MaxRequestsPerChild => config_parameters["apache"]["MaxRequestsPerChild"],
:LogLevel => log_level,
:CustomLog => custom_log
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment