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