]> git.openstreetmap.org Git - chef.git/blob - cookbooks/apache/recipes/default.rb
Fix new rubocop warnings
[chef.git] / cookbooks / apache / recipes / default.rb
1 #
2 # Cookbook Name:: apache
3 # Recipe:: default
4 #
5 # Copyright 2011, OpenStreetMap Foundation
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19
20 include_recipe "ssl"
21
22 package "apache2"
23 package "libwww-perl"
24
25 %w[event itk prefork worker].each do |mpm|
26   if mpm == node[:apache][:mpm]
27     apache_module "mpm_#{mpm}" do
28       action [:enable]
29     end
30   else
31     apache_module "mpm_#{mpm}" do
32       action [:disable]
33     end
34   end
35 end
36
37 admins = data_bag_item("apache", "admins")
38
39 apache_conf "httpd" do
40   template "httpd.conf.erb"
41   notifies :reload, "service[apache2]"
42 end
43
44 template "/etc/apache2/ports.conf" do
45   source "ports.conf.erb"
46   owner "root"
47   group "root"
48   mode 0o644
49 end
50
51 service "apache2" do
52   action [:enable, :start]
53   supports :status => true, :restart => true, :reload => true
54 end
55
56 apache_module "info" do
57   conf "info.conf.erb"
58   variables :hosts => admins["hosts"]
59 end
60
61 apache_module "status" do
62   conf "status.conf.erb"
63   variables :hosts => admins["hosts"]
64 end
65
66 apache_module "deflate" do
67   conf "deflate.conf.erb"
68 end
69
70 apache_module "reqtimeout" do
71   action [:disable]
72 end
73
74 apache_module "ssl"
75
76 apache_conf "ssl" do
77   template "ssl.erb"
78 end
79
80 munin_plugin "apache_accesses"
81 munin_plugin "apache_processes"
82 munin_plugin "apache_volume"