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_ssl inherits base { |
55 |
package { "apache-mod_ssl": |
56 |
ensure => installed |
57 |
} |
58 |
} |
59 |
|
60 |
class mod_wsgi inherits base { |
61 |
package { "apache-mod_wsgi": |
62 |
ensure => installed |
63 |
} |
64 |
|
65 |
file { $wsgi_dir: |
66 |
ensure => directory, |
67 |
owner => root, |
68 |
group => root, |
69 |
mode => 644, |
70 |
} |
71 |
} |
72 |
|
73 |
define vhost_redirect_ssl() { |
74 |
file { "redirect_ssl_$name.conf": |
75 |
path => "$vhost_dir/redirect_ssl_$name.conf", |
76 |
ensure => "present", |
77 |
owner => root, |
78 |
group => root, |
79 |
mode => 644, |
80 |
notify => Service['apache'], |
81 |
content => template("apache/vhost_ssl_redirect.conf") |
82 |
} |
83 |
} |
84 |
|
85 |
define vhost_catalyst_app($script, $location = '', $process = 4, $use_ssl = false) { |
86 |
|
87 |
include apache::mod_fastcgi |
88 |
|
89 |
file { "$name.conf": |
90 |
path => "$vhost_dir/$name.conf", |
91 |
ensure => "present", |
92 |
owner => root, |
93 |
group => root, |
94 |
mode => 644, |
95 |
notify => Service['apache'], |
96 |
content => template("apache/vhost_catalyst_app.conf") |
97 |
} |
98 |
} |
99 |
|
100 |
define vhost_django_app($module, $module_path = '/usr/share') { |
101 |
include apache::mod_wsgi |
102 |
|
103 |
file { "$name.conf": |
104 |
path => "$vhost_dir/$name.conf", |
105 |
ensure => "present", |
106 |
owner => root, |
107 |
group => root, |
108 |
mode => 644, |
109 |
notify => Service['apache'], |
110 |
content => template("apache/vhost_django_app.conf") |
111 |
} |
112 |
|
113 |
# fichier django wsgi |
114 |
file { "$name.wsgi": |
115 |
path => "$wsgi_dir/$name.wsgi", |
116 |
ensure => "present", |
117 |
owner => root, |
118 |
group => root, |
119 |
mode => 755, |
120 |
notify => Service['apache'], |
121 |
content => template("apache/django.wsgi") |
122 |
} |
123 |
} |
124 |
} |