1 |
class websites { |
2 |
class base { |
3 |
$webdatadir = '/var/www/vhosts' |
4 |
} |
5 |
|
6 |
# vhost to host static files used by web sites |
7 |
class static inherits base { |
8 |
$vhostdir = "$webdatadir/static.$domain" |
9 |
$svn_location = "svn://svn.$domain/svn/web/www/trunk/g/" |
10 |
apache::vhost_other_app { "static.$domain": |
11 |
vhost_file => 'websites/vhost_static.conf', |
12 |
} |
13 |
|
14 |
file { $vhostdir: |
15 |
ensure => directory, |
16 |
mode => 655, |
17 |
} |
18 |
|
19 |
subversion::snapshot { "$vhostdir/g": |
20 |
source => $svn_location |
21 |
} |
22 |
} |
23 |
|
24 |
class www inherits base { |
25 |
include apache::mod_php |
26 |
include apache::mod_geoip |
27 |
$vhost = "www-test.$domain" |
28 |
$vhostdir = "$webdatadir/www.$domain" |
29 |
$svn_location = "svn://svn.$domain/svn/web/www/trunk" |
30 |
|
31 |
apache::apache_group |
32 |
|
33 |
subversion::snapshot { $vhostdir: |
34 |
source => $svn_location |
35 |
} |
36 |
|
37 |
file { "$vhostdir/var/tmp/cache": |
38 |
ensure => directory, |
39 |
owner => root, |
40 |
group => $apache::base::apache_group, |
41 |
mode => 0660, |
42 |
} |
43 |
|
44 |
apache::vhost_base { "$vhost": |
45 |
content => template('websites/vhost_www.conf'), |
46 |
location => $vhostdir, |
47 |
options => ['FollowSymLinks'], |
48 |
} |
49 |
apache::vhost_base { "ssl_$vhost": |
50 |
use_ssl => true, |
51 |
vhost => $vhost, |
52 |
content => template('websites/vhost_www.conf'), |
53 |
location => $vhostdir, |
54 |
options => ['FollowSymLinks'], |
55 |
} |
56 |
|
57 |
package { ['php-mbstring', 'php-mcrypt', 'php-gettext']: |
58 |
ensure => "installed", |
59 |
} |
60 |
} |
61 |
|
62 |
class hugs inherits base { |
63 |
$vhostdir = "$webdatadir/hugs.$domain" |
64 |
$svn_location = "svn://svn.$domain/svn/web/hugs/public/" |
65 |
apache::vhost_base { "hugs.$domain": |
66 |
location => $vhostdir, |
67 |
} |
68 |
|
69 |
subversion::snapshot { "$vhostdir": |
70 |
source => $svn_location |
71 |
} |
72 |
|
73 |
package { php-exif: |
74 |
ensure => "installed", |
75 |
} |
76 |
} |
77 |
|
78 |
class releases inherits base { |
79 |
$vhostdir = "$webdatadir/releases.$domain" |
80 |
$svn_location = "svn://svn.$domain/svn/web/releases/" |
81 |
apache::vhost_base { "releases.$domain": |
82 |
location => $vhostdir, |
83 |
options => [ "FollowSymLinks" ] |
84 |
} |
85 |
apache::vhost_base { "ssl_releases.$domain": |
86 |
vhost => "releases.$domain", |
87 |
use_ssl => true, |
88 |
location => $vhostdir, |
89 |
options => [ "FollowSymLinks" ] |
90 |
} |
91 |
|
92 |
subversion::snapshot { "$vhostdir": |
93 |
source => $svn_location |
94 |
} |
95 |
} |
96 |
|
97 |
class www_outage { |
98 |
apache::vhost_redirect { "www.$domain": |
99 |
url => 'http://blog.mageia.org/en/2011/12/19/server-outage/#' |
100 |
} |
101 |
apache::vhost_redirect { "$domain": |
102 |
url => 'http://blog.mageia.org/en/2011/12/19/server-outage/#' |
103 |
} |
104 |
} |
105 |
|
106 |
class svn { |
107 |
apache::vhost_redirect { "svn.$domain": |
108 |
url => "http://svnweb.$domain/", |
109 |
} |
110 |
} |
111 |
|
112 |
class forum_proxy { |
113 |
|
114 |
$web_domain = "forums.$domain" |
115 |
host { "$web_domain": |
116 |
ip => '192.168.122.131', |
117 |
ensure => 'present', |
118 |
} |
119 |
|
120 |
apache::vhost_reverse_proxy { "$web_domain": |
121 |
url => "http://$web_domain/", |
122 |
} |
123 |
|
124 |
apache::vhost_reverse_proxy { "ssl_$web_domain": |
125 |
vhost => $web_domain, |
126 |
use_ssl => true, |
127 |
url => "http://$web_domain/", |
128 |
} |
129 |
} |
130 |
|
131 |
class pkgcpan inherits base { |
132 |
$vhost = "pkgcpan.$domain" |
133 |
$vhostdir = "$webdatadir/$vhost" |
134 |
|
135 |
apache::vhost_base { "$vhost": |
136 |
location => $vhostdir, |
137 |
options => [ "Indexes" ] |
138 |
} |
139 |
|
140 |
file { $vhostdir: |
141 |
ensure => directory, |
142 |
} |
143 |
|
144 |
package { "perl-Module-Packaged-Generator": |
145 |
ensure => installed, |
146 |
} |
147 |
|
148 |
cron { "update cpanpkg": |
149 |
hour => 23, |
150 |
require => Package['perl-Module-Packaged-Generator'], |
151 |
command => "pkgcpan -q -f $vhostdir/cpan_Mageia.db -d Mageia", |
152 |
} |
153 |
} |
154 |
} |