Mercurial > repos > other > Puppet
comparison modules/website/manifests/http.pp @ 12:72466547cc79
Update HTTP website manifest so that it works, since we're now hosting a HTTP site
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 01 Dec 2014 20:27:38 +0000 |
parents | 956e484adc12 |
children | d2b4750e843a |
comparison
equal
deleted
inserted
replaced
11:4b42f65ae875 | 12:72466547cc79 |
---|---|
1 define website( | 1 define website::http( |
2 $docroot, | 2 $docroot = undef, |
3 $docroot_owner = 'root', | 3 $docroot_owner = 'root', |
4 $docroot_group = 'root', | 4 $docroot_group = 'root', |
5 $serveraliases = [], | 5 $serveraliases = [], |
6 $ensure = 'present', | 6 $ensure = 'present', |
7 $custom_fragment = undef | 7 $custom_fragment = undef |
8 ) { | 8 ) { |
9 validate_re($ensure, '^(present|absent)$', | 9 validate_re($ensure, '^(present|absent)$', |
10 "${ensure} is not supported for ensure. | 10 "${ensure} is not supported for ensure. |
11 Allowed values are 'present' and 'absent'.") | 11 Allowed values are 'present' and 'absent'.") |
12 | 12 |
13 if $name =~ /^([^\.]+)\./ { | 13 if ! defined(Class['website']) { |
14 $logpart = $1 | 14 fail('You must include the website base class before using any website defined resources') |
15 } | |
16 | |
17 validate_re($ensure, '^(present|absent)$', | |
18 "${ensure} is not supported for ensure. | |
19 Allowed values are 'present' and 'absent'.") | |
20 | |
21 $shortname = domain_to_short_name($name) | |
22 $logpart = $shortname | |
23 | |
24 if $docroot == undef { | |
25 $siteroot = "${website::basedir}/${shortname}" | |
15 } else { | 26 } else { |
16 $logpart = $name | 27 $siteroot = $docroot |
17 } | 28 } |
18 | 29 |
19 apache::vhost { $name: | 30 apache::vhost { $name: |
20 port => '80', | 31 port => '80', |
21 docroot => $docroot, | 32 docroot => $siteroot, |
22 docroot_owner => $docroot_owner, | 33 docroot_owner => $docroot_owner, |
23 docroot_group => $docroot_group, | 34 docroot_group => $docroot_group, |
24 custom_fragment => $custom_fragment, | 35 custom_fragment => $custom_fragment, |
25 logroot => '/var/log/apache/', | 36 logroot => '/var/log/apache/', |
26 access_log_file => "access_${logpart}.log", | 37 access_log_file => "access_${logpart}.log", |