/
apache.pp
37 lines (32 loc) · 1.14 KB
/
apache.pp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class rvm::passenger::apache(
$ruby
) {
case $::operatingsystem {
'centos', 'redhat', 'fedora': {
$modules_path = '/etc/httpd/modules'
}
'ubuntu', 'debian': {
$modules_path = '/etc/apache2/mods-enabled'
}
default: {
fail "Unknown RVM dependencies for ${::operatingsystem}"
}
}
package {"${ruby}@global:passenger":
provider => 'rvm_gem',
require => Package[$ruby],
}
exec {'passenger-install-apache2-module':
command => "rvm $ruby exec passenger-install-apache2-module -a",
path => "/usr/local/rvm/bin:/usr/bin:/usr/sbin:/bin",
# Cut the path for the .so file from the snippet (1st row 3rd field)
unless => "test -f \"`rvm $ruby exec passenger-install-apache2-module --snippet | head -n 1 | cut -f 3 -d ' '`\"",
logoutput => on_failure,
require => Package["$ruby@global:passenger"],
}
exec {"generate apache passenger conf":
command => "/usr/local/rvm/bin/rvm $ruby exec passenger-install-apache2-module --snippet > ${modules_path}/passenger.conf",
creates => "${modules_path}/passenger.conf",
require => Package["$ruby@global:passenger"],
}
}