1 |
class apache { |
2 |
|
3 |
$vhost_dir = "/etc/httpd/conf/vhosts.d" |
4 |
$wsgi_dir = "/usr/local/lib/wsgi" |
5 |
|
6 |
class base { |
7 |
package { "apache-mpm-prefork": |
8 |
alias => apache, |
9 |
ensure => installed |
10 |
} |
11 |
|
12 |
service { httpd: |
13 |
alias => apache, |
14 |
ensure => running, |
15 |
subscribe => [ Package['apache-mpm-prefork'] ], |
16 |
} |
17 |
|
18 |
file { "customization.conf": |
19 |
ensure => present, |
20 |
path => "/etc/httpd/conf.d/customization.conf", |
21 |
content => template("apache/customization.conf"), |
22 |
require => Package["apache"], |
23 |
notify => Service["apache"], |
24 |
owner => root, |
25 |
group => root, |
26 |
mode => 644, |
27 |
} |
28 |
} |
29 |
|
30 |
class mod_php inherits base { |
31 |
package { "apache-mod_php": |
32 |
ensure => installed |
33 |
} |
34 |
} |
35 |
|
36 |
class mod_perl inherits base { |
37 |
package { "apache-mod_perl": |
38 |
ensure => installed |
39 |
} |
40 |
} |
41 |
|
42 |
class mod_fcgid inherits base { |
43 |
package { "apache-mod_fcgid": |
44 |
ensure => installed |
45 |
} |
46 |
} |
47 |
|
48 |
class mod_fastcgi inherits base { |
49 |
package { "apache-mod_fastcgi": |
50 |
ensure => installed |
51 |
} |
52 |
} |
53 |
|
54 |
class mod_wsgi inherits base { |
55 |
package { "apache-mod_wsgi": |
56 |
ensure => installed |
57 |
} |
58 |
|
59 |
file { $wsgi_dir: |
60 |
ensure => directory, |
61 |
owner => root, |
62 |
group => root, |
63 |
mode => 644, |
64 |
} |
65 |
} |
66 |
|
67 |
define vhost_redirect_ssl() { |
68 |
file { "redirect_ssl_$name.conf": |
69 |
path => "$vhost_dir/redirect_ssl_$name.conf", |
70 |
ensure => "present", |
71 |
owner => root, |
72 |
group => root, |
73 |
mode => 644, |
74 |
notify => Service['apache'], |
75 |
content => template("apache/vhost_ssl_redirect.conf") |
76 |
} |
77 |
} |
78 |
|
79 |
define vhost_catalyst_app($script, $process = 4, $use_ssl = false) { |
80 |
|
81 |
include apache::mod_fastcgi |
82 |
|
83 |
file { "$name.conf": |
84 |
path => "$vhost_dir/$name.conf", |
85 |
ensure => "present", |
86 |
owner => root, |
87 |
group => root, |
88 |
mode => 644, |
89 |
notify => Service['apache'], |
90 |
content => template("apache/vhost_catalyst_app.conf") |
91 |
} |
92 |
} |
93 |
|
94 |
define vhost_django_app($module, $module_path = '/usr/share') { |
95 |
include apache::mod_wsgi |
96 |
|
97 |
file { "$name.conf": |
98 |
path => "$vhost_dir/$name.conf", |
99 |
ensure => "present", |
100 |
owner => root, |
101 |
group => root, |
102 |
mode => 644, |
103 |
notify => Service['apache'], |
104 |
content => template("apache/vhost_django_app.conf") |
105 |
} |
106 |
|
107 |
# fichier django wsgi |
108 |
file { "$name.wsgi": |
109 |
path => "$wsgi_dir/$name.wsgi", |
110 |
ensure => "present", |
111 |
owner => root, |
112 |
group => root, |
113 |
mode => 755, |
114 |
notify => Service['apache'], |
115 |
content => template("apache/django.wsgi") |
116 |
} |
117 |
} |
118 |
} |