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