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 |
subversion::snapshot { $vhostdir: |
32 |
source => $svn_location |
33 |
} |
34 |
|
35 |
apache::vhost_base { "$vhost": |
36 |
content => template('websites/vhost_www.conf'), |
37 |
location => $vhostdir, |
38 |
options => ['FollowSymLinks'], |
39 |
} |
40 |
apache::vhost_base { "ssl_$vhost": |
41 |
use_ssl => true, |
42 |
vhost => $vhost, |
43 |
content => template('websites/vhost_www.conf'), |
44 |
location => $vhostdir, |
45 |
options => ['FollowSymLinks'], |
46 |
} |
47 |
|
48 |
package { ['php-mbstring', 'php-mcrypt', 'php-gettext']: |
49 |
ensure => "installed", |
50 |
} |
51 |
} |
52 |
|
53 |
class hugs inherits base { |
54 |
$vhostdir = "$webdatadir/hugs.$domain" |
55 |
$svn_location = "svn://svn.$domain/svn/web/hugs/public/" |
56 |
apache::vhost_base { "hugs.$domain": |
57 |
location => $vhostdir, |
58 |
} |
59 |
|
60 |
subversion::snapshot { "$vhostdir": |
61 |
source => $svn_location |
62 |
} |
63 |
|
64 |
package { php-exif: |
65 |
ensure => "installed", |
66 |
} |
67 |
} |
68 |
|
69 |
class releases inherits base { |
70 |
$vhostdir = "$webdatadir/releases.$domain" |
71 |
$svn_location = "svn://svn.$domain/svn/web/releases/" |
72 |
apache::vhost_base { "releases.$domain": |
73 |
location => $vhostdir, |
74 |
options => [ "FollowSymLinks" ] |
75 |
} |
76 |
apache::vhost_base { "ssl_releases.$domain": |
77 |
vhost => "releases.$domain", |
78 |
use_ssl => true, |
79 |
location => $vhostdir, |
80 |
options => [ "FollowSymLinks" ] |
81 |
} |
82 |
|
83 |
subversion::snapshot { "$vhostdir": |
84 |
source => $svn_location |
85 |
} |
86 |
} |
87 |
|
88 |
class www_outage { |
89 |
apache::vhost_redirect { "www.$domain": |
90 |
url => 'http://blog.mageia.org/en/2011/12/19/server-outage/#' |
91 |
} |
92 |
apache::vhost_redirect { "$domain": |
93 |
url => 'http://blog.mageia.org/en/2011/12/19/server-outage/#' |
94 |
} |
95 |
} |
96 |
|
97 |
class svn { |
98 |
apache::vhost_redirect { "svn.$domain": |
99 |
url => "http://svnweb.$domain/", |
100 |
} |
101 |
} |
102 |
|
103 |
class forum_proxy { |
104 |
|
105 |
$web_domain = "forums.$domain" |
106 |
host { "$web_domain": |
107 |
ip => '192.168.122.131', |
108 |
ensure => 'present', |
109 |
} |
110 |
|
111 |
apache::vhost_reverse_proxy { "$web_domain": |
112 |
url => "http://$web_domain/", |
113 |
} |
114 |
|
115 |
apache::vhost_reverse_proxy { "ssl_$web_domain": |
116 |
vhost => $web_domain, |
117 |
use_ssl => true, |
118 |
url => "http://$web_domain/", |
119 |
} |
120 |
} |
121 |
|
122 |
class pkgcpan inherits base { |
123 |
$vhost = "pkgcpan.$domain" |
124 |
$vhostdir = "$webdatadir/$vhost" |
125 |
|
126 |
apache::vhost_base { "$vhost": |
127 |
location => $vhostdir, |
128 |
options => [ "Indexes" ] |
129 |
} |
130 |
|
131 |
file { $vhostdir: |
132 |
ensure => directory, |
133 |
} |
134 |
|
135 |
package { "perl-Module-Packaged-Generator": |
136 |
ensure => installed, |
137 |
} |
138 |
|
139 |
cron { "update cpanpkg": |
140 |
hour => 23, |
141 |
require => Package['perl-Module-Packaged-Generator'], |
142 |
command => "pkgcpan -q -f $vhostdir/cpan_Mageia.db -d Mageia", |
143 |
} |
144 |
} |
145 |
} |