whitespace change only: modules/apache2/manifests/init.pp (make lint happy)
[mirror/dsa-puppet.git] / modules / apache2 / manifests / init.pp
1 # = Class: apache2
2 #
3 # Standard apache config debian.org hosts
4 #
5 # == Sample Usage:
6 #
7 #   include apache2
8 #
9 class apache2 {
10   include webserver
11
12   package { 'apache2':
13     ensure => installed,
14   }
15
16   service { 'apache2':
17     ensure  => running,
18     require => Package['apache2'],
19   }
20
21   apache2::module { 'reqtimeout': }
22   apache2::module { 'info': }
23   apache2::module { 'status': }
24   apache2::module { 'headers': }
25   apache2::module { 'macro': }
26
27   apache2::site { '00-default':
28     site    => 'default-debian.org',
29     content => template('apache2/default-debian.org.erb'),
30   }
31   apache2::site { 'xx-default-ssl':
32     site    => 'default-debian.org-ssl',
33     content => template('apache2/default-debian.org-ssl.erb'),
34   }
35
36   apache2::site { '000-default':
37     ensure => absent,
38   }
39
40   apache2::config { 'serve-cgi-bin':
41     ensure => absent,
42   }
43
44   if has_role('udd') {
45     $memlimit = 512 * 1024 * 1024
46   } elsif has_role('dgit_git') {
47     $memlimit = 512 * 1024 * 1024
48   } elsif has_role('sso') {
49     $memlimit = 512 * 1024 * 1024
50   } elsif has_role('popcon') {
51     $memlimit = 512 * 1024 * 1024
52   } elsif has_role('qamaster') {
53     $memlimit = 300 * 1024 * 1024
54   } else {
55     $memlimit = 192 * 1024 * 1024
56   }
57   # debbugs cgis like to fork and don't deal well with EAGAIN
58   if has_role('bugs_base') {
59     $proclimit = 450
60   } else {
61     $proclimit = 256
62   }
63
64   apache2::config { 'resource-limits':
65     content => template('apache2/resource-limits.erb'),
66   }
67
68   apache2::config { 'security':
69     source => 'puppet:///modules/apache2/security',
70   }
71
72   apache2::config { 'logformat-privacy':
73     source => 'puppet:///modules/apache2/logformat-privacy',
74   }
75
76   apache2::config { 'local-serverinfo':
77     source => 'puppet:///modules/apache2/local-serverinfo',
78   }
79
80   apache2::config { 'server-status':
81     source => 'puppet:///modules/apache2/server-status',
82   }
83
84   apache2::config { 'puppet-ssl-macros':
85     source => 'puppet:///modules/apache2/puppet-ssl-macros',
86   }
87
88   apache2::config { 'puppet-ftp-macros':
89     source => 'puppet:///modules/apache2/puppet-ftp-macros',
90   }
91
92   apache2::config { 'puppet-config':
93     content => template('apache2/puppet-config.erb'),
94   }
95
96   apache2::config { 'headers':
97     source => 'puppet:///modules/apache2/headers',
98   }
99
100   apache2::config { 'disabled-service':
101     source => 'puppet:///modules/apache2/disabled-service',
102   }
103
104   apache2::module { 'mpm_event': ensure => absent }
105   if has_role('apache_prefork') {
106     apache2::module { 'mpm_worker': ensure => absent }
107     apache2::module { 'mpm_prefork': }
108   } else {
109     apache2::module { 'mpm_prefork': ensure => absent }
110     apache2::module { 'mpm_worker': }
111   }
112   file { '/etc/apache2/mods-available/mpm_worker.conf':
113     content => template('apache2/mpm_worker.erb'),
114   }
115
116   file { '/etc/logrotate.d/apache2':
117     source => 'puppet:///modules/apache2/apache2.logrotate',
118   }
119
120   file { '/var/log/apache2':
121     ensure => directory,
122     mode   => '0755',
123   }
124   file { '/var/log/apache2/.nobackup':
125     mode    => '0644',
126     content => '',
127   }
128
129   munin::check { 'apache_accesses': }
130   munin::check { 'apache_processes': }
131   munin::check { 'apache_volume': }
132   munin::check { 'apache_servers': }
133   munin::check { 'ps_apache2':
134     script => 'ps_',
135   }
136   # The munin script needs this
137   package { 'libwww-perl':
138     ensure => installed,
139   }
140
141   if (! has_role('apache_not_public')) {
142     if has_role('apache_ratelimited') {
143       include apache2::dynamic
144     } else {
145       ferm::rule { 'dsa-http':
146         prio        => '23',
147         description => 'Allow web access',
148         rule        => '&SERVICE(tcp, (http https))'
149       }
150
151       ferm::rule { 'dsa-http-v6':
152         domain      => '(ip6)',
153         prio        => '23',
154         description => 'Allow web access',
155         rule        => '&SERVICE(tcp, (http https))'
156       }
157     }
158   }
159
160   exec { 'service apache2 reload':
161     path        => '/usr/bin:/usr/sbin:/bin:/sbin',
162     command     => 'service apache2 reload',
163     refreshonly => true,
164     require     =>  Package['apache2'],
165   }
166
167   apache2::config { 'puppet-ssl-key-pins':
168     content => template('apache2/ssl-key-pins.erb'),
169     notify  => Exec['service apache2 reload'],
170   }
171
172   apache2::config { 'local-scheduled-shutdown':
173     source => 'puppet:///modules/apache2/local-scheduled-shutdown',
174   }
175 }