annotate modules/website/manifests/http.pp @ 161:d2b4750e843a puppet-3.6

Add custom log format - combined plus requested domain This helps by logging which domain people hit and got redirected by without having per-domain logs
author IBBoard <dev@ibboard.co.uk>
date Sun, 02 Apr 2017 20:09:13 +0100
parents 72466547cc79
children 1df1e161bbb5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
1 define website::http(
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
2 $docroot = undef,
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 $docroot_owner = 'root',
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 $docroot_group = 'root',
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 $serveraliases = [],
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 $ensure = 'present',
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 $custom_fragment = undef
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 ) {
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 validate_re($ensure, '^(present|absent)$',
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 "${ensure} is not supported for ensure.
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 Allowed values are 'present' and 'absent'.")
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12
12
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
13 if ! defined(Class['website']) {
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
14 fail('You must include the website base class before using any website defined resources')
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
15 }
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
16
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
17 validate_re($ensure, '^(present|absent)$',
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
18 "${ensure} is not supported for ensure.
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
19 Allowed values are 'present' and 'absent'.")
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
20
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
21 $shortname = domain_to_short_name($name)
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
22 $logpart = $shortname
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
23
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
24 if $docroot == undef {
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
25 $siteroot = "${website::basedir}/${shortname}"
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 } else {
12
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
27 $siteroot = $docroot
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 }
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 apache::vhost { $name:
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 port => '80',
12
72466547cc79 Update HTTP website manifest so that it works, since we're now hosting a HTTP site
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
32 docroot => $siteroot,
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 docroot_owner => $docroot_owner,
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 docroot_group => $docroot_group,
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 custom_fragment => $custom_fragment,
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 logroot => '/var/log/apache/',
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 access_log_file => "access_${logpart}.log",
161
d2b4750e843a Add custom log format - combined plus requested domain
IBBoard <dev@ibboard.co.uk>
parents: 12
diff changeset
38 access_log_format => "%h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-agent}i\\\" %{Host}i",
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 serveraliases => $serveraliases,
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 ensure => $ensure,
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 }
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 }