1 |
misc |
80 |
class apache { |
2 |
|
|
|
3 |
|
|
class base { |
4 |
|
|
package { "apache-mpm-prefork": |
5 |
misc |
117 |
alias => apache, |
6 |
misc |
80 |
ensure => installed |
7 |
|
|
} |
8 |
|
|
|
9 |
misc |
96 |
service { httpd: |
10 |
|
|
alias => apache, |
11 |
misc |
80 |
ensure => running, |
12 |
|
|
subscribe => [ Package['apache-mpm-prefork'] ], |
13 |
|
|
} |
14 |
misc |
117 |
|
15 |
|
|
file { "customization.conf": |
16 |
|
|
ensure => present, |
17 |
misc |
126 |
path => "/etc/httpd/conf.d/customization.conf", |
18 |
misc |
117 |
content => template("apache/customization.conf"), |
19 |
|
|
require => Package["apache"], |
20 |
|
|
notify => Service["apache"], |
21 |
|
|
owner => root, |
22 |
|
|
group => root, |
23 |
|
|
mode => 644, |
24 |
|
|
} |
25 |
boklm |
207 |
|
26 |
|
|
file { "00_default_vhosts.conf": |
27 |
|
|
path => "/etc/httpd/conf/vhosts.d/00_default_vhosts.conf", |
28 |
|
|
ensure => "present", |
29 |
|
|
owner => root, |
30 |
|
|
group => root, |
31 |
|
|
mode => 644, |
32 |
|
|
notify => Service['apache'], |
33 |
|
|
content => template("apache/00_default_vhosts.conf") |
34 |
|
|
} |
35 |
misc |
80 |
} |
36 |
|
|
|
37 |
|
|
class mod_php inherits base { |
38 |
|
|
package { "apache-mod_php": |
39 |
|
|
ensure => installed |
40 |
|
|
} |
41 |
|
|
} |
42 |
|
|
|
43 |
|
|
class mod_perl inherits base { |
44 |
|
|
package { "apache-mod_perl": |
45 |
|
|
ensure => installed |
46 |
|
|
} |
47 |
|
|
} |
48 |
|
|
|
49 |
misc |
84 |
class mod_fcgid inherits base { |
50 |
|
|
package { "apache-mod_fcgid": |
51 |
|
|
ensure => installed |
52 |
|
|
} |
53 |
|
|
} |
54 |
|
|
|
55 |
misc |
124 |
class mod_fastcgi inherits base { |
56 |
|
|
package { "apache-mod_fastcgi": |
57 |
|
|
ensure => installed |
58 |
|
|
} |
59 |
|
|
} |
60 |
misc |
84 |
|
61 |
misc |
192 |
class mod_ssl inherits base { |
62 |
misc |
487 |
file { "/etc/ssl/apache/": |
63 |
|
|
ensure => directory |
64 |
|
|
} |
65 |
|
|
|
66 |
misc |
192 |
package { "apache-mod_ssl": |
67 |
|
|
ensure => installed |
68 |
|
|
} |
69 |
|
|
} |
70 |
|
|
|
71 |
misc |
80 |
class mod_wsgi inherits base { |
72 |
|
|
package { "apache-mod_wsgi": |
73 |
|
|
ensure => installed |
74 |
|
|
} |
75 |
misc |
182 |
|
76 |
misc |
201 |
file { "/usr/local/lib/wsgi": |
77 |
misc |
182 |
ensure => directory, |
78 |
|
|
owner => root, |
79 |
|
|
group => root, |
80 |
|
|
mode => 644, |
81 |
|
|
} |
82 |
misc |
80 |
} |
83 |
misc |
167 |
|
84 |
misc |
176 |
define vhost_redirect_ssl() { |
85 |
|
|
file { "redirect_ssl_$name.conf": |
86 |
misc |
201 |
path => "/etc/httpd/conf/vhosts.d/redirect_ssl_$name.conf", |
87 |
misc |
176 |
ensure => "present", |
88 |
|
|
owner => root, |
89 |
|
|
group => root, |
90 |
|
|
mode => 644, |
91 |
|
|
notify => Service['apache'], |
92 |
|
|
content => template("apache/vhost_ssl_redirect.conf") |
93 |
|
|
} |
94 |
|
|
} |
95 |
misc |
167 |
|
96 |
misc |
194 |
define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false) { |
97 |
misc |
176 |
|
98 |
misc |
167 |
include apache::mod_fastcgi |
99 |
|
|
|
100 |
misc |
489 |
if $use_ssl { |
101 |
|
|
include apache::mod_ssl |
102 |
|
|
openssl::self_signed_cert{ "$name": |
103 |
misc |
497 |
directory => "/etc/ssl/apache/", |
104 |
|
|
before => File["$name.conf"], |
105 |
misc |
489 |
} |
106 |
|
|
} |
107 |
|
|
|
108 |
misc |
167 |
file { "$name.conf": |
109 |
misc |
201 |
path => "/etc/httpd/conf/vhosts.d/$name.conf", |
110 |
misc |
167 |
ensure => "present", |
111 |
|
|
owner => root, |
112 |
|
|
group => root, |
113 |
|
|
mode => 644, |
114 |
|
|
notify => Service['apache'], |
115 |
|
|
content => template("apache/vhost_catalyst_app.conf") |
116 |
|
|
} |
117 |
|
|
} |
118 |
misc |
182 |
|
119 |
misc |
621 |
define vhost_django_app($module = false, $module_path = false, $use_ssl = false) { |
120 |
misc |
182 |
include apache::mod_wsgi |
121 |
|
|
|
122 |
misc |
621 |
if $use_ssl { |
123 |
|
|
include apache::mod_ssl |
124 |
|
|
openssl::self_signed_cert{ "$name": |
125 |
|
|
directory => "/etc/ssl/apache/", |
126 |
|
|
before => File["$name.conf"], |
127 |
|
|
} |
128 |
|
|
} |
129 |
|
|
|
130 |
misc |
612 |
# module is a ruby reserved keyword, cannot be used in templates |
131 |
|
|
$django_module = $module |
132 |
misc |
182 |
file { "$name.conf": |
133 |
misc |
201 |
path => "/etc/httpd/conf/vhosts.d/$name.conf", |
134 |
misc |
182 |
ensure => "present", |
135 |
|
|
owner => root, |
136 |
|
|
group => root, |
137 |
|
|
mode => 644, |
138 |
|
|
notify => Service['apache'], |
139 |
|
|
content => template("apache/vhost_django_app.conf") |
140 |
|
|
} |
141 |
|
|
|
142 |
|
|
# fichier django wsgi |
143 |
|
|
file { "$name.wsgi": |
144 |
misc |
201 |
path => "/usr/local/lib/wsgi/$name.wsgi", |
145 |
misc |
182 |
ensure => "present", |
146 |
|
|
owner => root, |
147 |
|
|
group => root, |
148 |
|
|
mode => 755, |
149 |
|
|
notify => Service['apache'], |
150 |
|
|
content => template("apache/django.wsgi") |
151 |
|
|
} |
152 |
|
|
} |
153 |
boklm |
280 |
|
154 |
|
|
define vhost_other_app($vhost_file) { |
155 |
misc |
412 |
include apache::base |
156 |
boklm |
280 |
file { "$name.conf": |
157 |
|
|
path => "/etc/httpd/conf/vhosts.d/$name.conf", |
158 |
|
|
ensure => "present", |
159 |
|
|
owner => root, |
160 |
|
|
group => root, |
161 |
|
|
mode => 644, |
162 |
|
|
notify => Service['apache'], |
163 |
|
|
content => template($vhost_file) |
164 |
|
|
} |
165 |
|
|
} |
166 |
|
|
|
167 |
|
|
define webapp_other($webapp_file) { |
168 |
misc |
422 |
include apache::base |
169 |
boklm |
280 |
$webappname = $name |
170 |
|
|
file { "webapp_$name.conf": |
171 |
|
|
path => "/etc/httpd/conf/webapps.d/$webappname.conf", |
172 |
|
|
ensure => "present", |
173 |
|
|
owner => root, |
174 |
|
|
group => root, |
175 |
|
|
mode => 644, |
176 |
|
|
notify => Service['apache'], |
177 |
|
|
content => template($webapp_file) |
178 |
|
|
} |
179 |
|
|
} |
180 |
misc |
80 |
} |