forked from blt04/puppet-rvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3f6d59a
commit e10e6f3
Showing
13 changed files
with
193 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class rvm::dependencies::centos { | ||
|
||
if ! defined(Package['which']) { package { 'which': ensure => installed } } | ||
if ! defined(Package['gcc']) { package { 'gcc': ensure => installed } } | ||
if ! defined(Package['gcc-c++']) { package { 'gcc-c++': ensure => installed } } | ||
if ! defined(Package['make']) { package { 'make': ensure => installed } } | ||
if ! defined(Package['gettext-devel']) { package { 'gettext-devel': ensure => installed } } | ||
if ! defined(Package['expat-devel']) { package { 'expat-devel': ensure => installed } } | ||
if ! defined(Package['curl-devel']) { package { 'curl-devel': ensure => installed } } | ||
if ! defined(Package['zlib-devel']) { package { 'zlib-devel': ensure => installed } } | ||
if ! defined(Package['openssl-devel']) { package { 'openssl-devel': ensure => installed } } | ||
if ! defined(Package['perl']) { package { 'perl': ensure => installed } } | ||
if ! defined(Package['cpio']) { package { 'cpio': ensure => installed } } | ||
if ! defined(Package['expat-devel']) { package { 'expat-devel': ensure => installed } } | ||
if ! defined(Package['gettext-devel']) { package { 'gettext-devel': ensure => installed } } | ||
if ! defined(Package['wget']) { package { 'wget': ensure => installed } } | ||
if ! defined(Package['bzip2']) { package { 'bzip2': ensure => installed } } | ||
if ! defined(Package['sendmail']) { package { 'sendmail': ensure => installed } } | ||
if ! defined(Package['mailx']) { package { 'mailx': ensure => installed } } | ||
if ! defined(Package['libxml2']) { package { 'libxml2': ensure => installed } } | ||
if ! defined(Package['libxml2-devel']) { package { 'libxml2-devel': ensure => installed } } | ||
if ! defined(Package['libxslt']) { package { 'libxslt': ensure => installed } } | ||
if ! defined(Package['libxslt-devel']) { package { 'libxslt-devel': ensure => installed } } | ||
if ! defined(Package['readline-devel']) { package { 'readline-devel': ensure => installed } } | ||
if ! defined(Package['patch']) { package { 'patch': ensure => installed } } | ||
if ! defined(Package['git']) { package { 'git': ensure => installed } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class rvm::dependencies::ubuntu { | ||
|
||
if ! defined(Package['build-essential']) { package { 'build-essential': ensure => installed } } | ||
if ! defined(Package['bison']) { package { 'bison': ensure => installed } } | ||
if ! defined(Package['openssl']) { package { 'openssl': ensure => installed } } | ||
if ! defined(Package['libreadline6']) { package { 'libreadline6': ensure => installed } } | ||
if ! defined(Package['libreadline6-dev']) { package { 'libreadline6-dev': ensure => installed } } | ||
if ! defined(Package['curl']) { package { 'curl': ensure => installed } } | ||
if ! defined(Package['git-core']) { package { 'git-core': ensure => installed } } | ||
if ! defined(Package['zlib1g']) { package { 'zlib1g': ensure => installed } } | ||
if ! defined(Package['zlib1g-dev']) { package { 'zlib1g-dev': ensure => installed } } | ||
if ! defined(Package['libssl-dev']) { package { 'libssl-dev': ensure => installed } } | ||
if ! defined(Package['libyaml-dev']) { package { 'libyaml-dev': ensure => installed } } | ||
if ! defined(Package['libsqlite3-0']) { package { 'libsqlite3-0': ensure => installed } } | ||
if ! defined(Package['libsqlite3-dev']) { package { 'libsqlite3-dev': ensure => installed } } | ||
if ! defined(Package['sqlite3']) { package { 'sqlite3': ensure => installed } } | ||
if ! defined(Package['libxml2-dev']) { package { 'libxml2-dev': ensure => installed } } | ||
if ! defined(Package['libxslt1-dev']) { package { 'libxslt1-dev': ensure => installed, alias => 'libxslt-dev' } } | ||
if ! defined(Package['autoconf']) { package { 'autoconf': ensure => installed } } | ||
if ! defined(Package['libc6-dev']) { package { 'libc6-dev': ensure => installed } } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,6 @@ | ||
class rvm::dependencies { | ||
|
||
if ! defined(Package['build-essential']) { package { 'build-essential': ensure => installed } } | ||
if ! defined(Package['bison']) { package { 'bison': ensure => installed } } | ||
if ! defined(Package['openssl']) { package { 'openssl': ensure => installed } } | ||
if ! defined(Package['libreadline6']) { package { 'libreadline6': ensure => installed } } | ||
if ! defined(Package['libreadline6-dev']) { package { 'libreadline6-dev': ensure => installed } } | ||
if ! defined(Package['curl']) { package { 'curl': ensure => installed } } | ||
if ! defined(Package['git-core']) { package { 'git-core': ensure => installed } } | ||
if ! defined(Package['zlib1g']) { package { 'zlib1g': ensure => installed } } | ||
if ! defined(Package['zlib1g-dev']) { package { 'zlib1g-dev': ensure => installed } } | ||
if ! defined(Package['libssl-dev']) { package { 'libssl-dev': ensure => installed } } | ||
if ! defined(Package['libyaml-dev']) { package { 'libyaml-dev': ensure => installed } } | ||
if ! defined(Package['libsqlite3-0']) { package { 'libsqlite3-0': ensure => installed } } | ||
if ! defined(Package['libsqlite3-dev']) { package { 'libsqlite3-dev': ensure => installed } } | ||
if ! defined(Package['sqlite3']) { package { 'sqlite3': ensure => installed } } | ||
if ! defined(Package['libxml2-dev']) { package { 'libxml2-dev': ensure => installed } } | ||
if ! defined(Package['libxslt1-dev']) { package { 'libxslt1-dev': ensure => installed, alias => 'libxslt-dev' } } | ||
if ! defined(Package['autoconf']) { package { 'autoconf': ensure => installed } } | ||
if ! defined(Package['libc6-dev']) { package { 'libc6-dev': ensure => installed } } | ||
|
||
case $operatingsystem { | ||
Ubuntu: { include rvm::dependencies::ubuntu } | ||
CentOS: { include rvm::dependencies::centos } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class rvm::passenger::apache::centos::post { | ||
|
||
exec { | ||
'passenger-install-apache2-module': | ||
command => "${binpath}rvm ${ruby_version} exec passenger-install-apache2-module -a", | ||
creates => "${gempath}/passenger-${version}/ext/apache2/mod_passenger.so", | ||
logoutput => 'on_failure', | ||
require => [Rvm_gem['passenger'], Package['httpd','httpd-devel','mod_ssl']]; | ||
} | ||
|
||
file { | ||
'/etc/httpd/conf.d/passenger.conf': | ||
content => template('rvm/passenger-apache-centos.conf.erb'), | ||
ensure => file, | ||
require => Exec['passenger-install-apache2-module']; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class rvm::passenger::apache::centos::pre { | ||
|
||
# Dependencies | ||
if ! defined(Package["httpd"]) { package { "httpd": ensure => installed } } | ||
if ! defined(Package["httpd-devel"]) { package { "httpd-devel": ensure => installed } } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class rvm::passenger::gem($ruby_version, $version, $rvm_prefix) { | ||
rvm_gem { | ||
"passenger": | ||
ruby_version => $ruby_version, | ||
ensure => $version, | ||
rvm_prefix => $rvm_prefix, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
class rvm::passenger::apache::ubuntu::post { | ||
|
||
exec { | ||
'passenger-install-apache2-module': | ||
command => "${binpath}rvm ${ruby_version} exec passenger-install-apache2-module -a", | ||
creates => "${gempath}/passenger-${version}/ext/apache2/mod_passenger.so", | ||
logoutput => 'on_failure', | ||
require => [Rvm_gem['passenger'], Package['apache2', 'build-essential', 'apache2-prefork-dev', | ||
'libapr-dev', 'libaprutil-dev', 'libcurl4-openssl-dev']], | ||
} | ||
|
||
file { | ||
'/etc/apache2/mods-available/passenger.load': | ||
content => "LoadModule passenger_module ${gempath}/passenger-${version}/ext/apache2/mod_passenger.so", | ||
ensure => file, | ||
require => Exec['passenger-install-apache2-module']; | ||
|
||
'/etc/apache2/mods-available/passenger.conf': | ||
content => template('rvm/passenger-apache.conf.erb'), | ||
ensure => file, | ||
require => Exec['passenger-install-apache2-module']; | ||
|
||
'/etc/apache2/mods-enabled/passenger.load': | ||
ensure => 'link', | ||
target => '../mods-available/passenger.load', | ||
require => File['/etc/apache2/mods-available/passenger.load']; | ||
|
||
'/etc/apache2/mods-enabled/passenger.conf': | ||
ensure => 'link', | ||
target => '../mods-available/passenger.conf', | ||
require => File['/etc/apache2/mods-available/passenger.conf']; | ||
} | ||
|
||
# Add Apache restart hooks | ||
if defined(Service['apache']) { | ||
File['/etc/apache2/mods-available/passenger.load'] ~> Service['apache'] | ||
File['/etc/apache2/mods-available/passenger.conf'] ~> Service['apache'] | ||
File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['apache'] | ||
File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['apache'] | ||
} | ||
if defined(Service['apache2']) { | ||
File['/etc/apache2/mods-available/passenger.load'] ~> Service['apache2'] | ||
File['/etc/apache2/mods-available/passenger.conf'] ~> Service['apache2'] | ||
File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['apache2'] | ||
File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['apache2'] | ||
} | ||
if defined(Service['httpd']) { | ||
File['/etc/apache2/mods-available/passenger.load'] ~> Service['httpd'] | ||
File['/etc/apache2/mods-available/passenger.conf'] ~> Service['httpd'] | ||
File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['httpd'] | ||
File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['httpd'] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class rvm::passenger::apache::ubuntu::pre { | ||
|
||
include apache | ||
# Dependencies | ||
if ! defined(Package['build-essential']) { package { build-essential: ensure => installed } } | ||
if ! defined(Package['apache2-prefork-dev']) { package { apache2-prefork-dev: ensure => installed } } | ||
if ! defined(Package['libapr1-dev']) { package { libapr1-dev: ensure => installed, alias => 'libapr-dev' } } | ||
if ! defined(Package['libaprutil1-dev']) { package { libaprutil1-dev: ensure => installed, alias => 'libaprutil-dev' } } | ||
if ! defined(Package['libcurl4-openssl-dev']) { package { libcurl4-openssl-dev: ensure => installed } } | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,122 +1,35 @@ | ||
|
||
class rvm::passenger($ruby_version, $version, $rvm_prefix) { | ||
rvm_gem { | ||
'passenger': | ||
ruby_version => $ruby_version, | ||
ensure => $version, | ||
rvm_prefix => $rvm_prefix, | ||
require => Rvm_system_ruby[$ruby_version]; | ||
} | ||
} | ||
|
||
|
||
class rvm::passenger::apache( | ||
$ruby_version, | ||
$version, | ||
$rvm_prefix = '/usr/local/', | ||
$mininstances = '1', | ||
$maxpoolsize = '6', | ||
$poolidletime = '300', | ||
$maxinstancesperapp = '0', | ||
$spawnmethod = 'smart-lv2' | ||
$ruby_version, | ||
$version, | ||
$rvm_prefix = '/usr/local/', | ||
$mininstances = '1', | ||
$maxpoolsize = '6', | ||
$poolidletime = '300', | ||
$maxinstancesperapp = '0', | ||
$spawnmethod = 'smart-lv2' | ||
) { | ||
|
||
# TODO: How to inherit this from above? | ||
class { 'rvm::passenger': ruby_version => $ruby_version, version => $version, rvm_prefix => $rvm_prefix } | ||
include apache | ||
|
||
include rvm::passenger::gem | ||
|
||
case $operatingsystem { | ||
Ubuntu: { include rvm::passenger::apache::ubuntu::pre } | ||
CentOS: { include rvm::passenger::apache::centos::pre } | ||
} | ||
|
||
class { | ||
'rvm::passenger::gem': | ||
ruby_version => $ruby_version, | ||
version => $version, | ||
rvm_prefix => $rvm_prefix | ||
} | ||
|
||
# TODO: How can we get the gempath automatically using the ruby version | ||
# Can we read the output of a command into a variable? | ||
# e.g. $gempath = `usr/local/bin/rvm ${ruby_version} exec rvm gemdir` | ||
$gempath = "${rvm_prefix}rvm/gems/${ruby_version}/gems" | ||
$binpath = "${rvm_prefix}rvm/bin/" | ||
|
||
|
||
# Dependencies | ||
if ! defined(Package['build-essential']) { package { build-essential: ensure => installed } } | ||
if ! defined(Package['apache2-prefork-dev']) { package { apache2-prefork-dev: ensure => installed } } | ||
if ! defined(Package['libapr1-dev']) { package { libapr1-dev: ensure => installed, alias => 'libapr-dev' } } | ||
if ! defined(Package['libaprutil1-dev']) { package { libaprutil1-dev: ensure => installed, alias => 'libaprutil-dev' } } | ||
if ! defined(Package['libcurl4-openssl-dev']) { package { libcurl4-openssl-dev: ensure => installed } } | ||
|
||
exec { | ||
'passenger-install-apache2-module': | ||
command => "${binpath}rvm ${ruby_version} exec passenger-install-apache2-module -a", | ||
creates => "${gempath}/passenger-${version}/ext/apache2/mod_passenger.so", | ||
logoutput => 'on_failure', | ||
require => [Rvm_gem['passenger'], Package[ | ||
'apache2', | ||
'build-essential', | ||
'apache2-prefork-dev', | ||
'libapr-dev', | ||
'libaprutil-dev', | ||
'libcurl4-openssl-dev' | ||
]]; | ||
} | ||
|
||
file { | ||
'/etc/apache2/mods-available/passenger.load': | ||
content => "LoadModule passenger_module ${gempath}/passenger-${version}/ext/apache2/mod_passenger.so", | ||
ensure => file, | ||
require => Exec['passenger-install-apache2-module']; | ||
|
||
'/etc/apache2/mods-available/passenger.conf': | ||
content => template('rvm/passenger-apache.conf.erb'), | ||
ensure => file, | ||
require => Exec['passenger-install-apache2-module']; | ||
|
||
'/etc/apache2/mods-enabled/passenger.load': | ||
ensure => 'link', | ||
target => '../mods-available/passenger.load', | ||
require => File['/etc/apache2/mods-available/passenger.load']; | ||
|
||
'/etc/apache2/mods-enabled/passenger.conf': | ||
ensure => 'link', | ||
target => '../mods-available/passenger.conf', | ||
require => File['/etc/apache2/mods-available/passenger.conf']; | ||
} | ||
|
||
# Add Apache restart hooks | ||
if defined(Service['apache']) { | ||
File['/etc/apache2/mods-available/passenger.load'] ~> Service['apache'] | ||
File['/etc/apache2/mods-available/passenger.conf'] ~> Service['apache'] | ||
File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['apache'] | ||
File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['apache'] | ||
} | ||
if defined(Service['apache2']) { | ||
File['/etc/apache2/mods-available/passenger.load'] ~> Service['apache2'] | ||
File['/etc/apache2/mods-available/passenger.conf'] ~> Service['apache2'] | ||
File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['apache2'] | ||
File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['apache2'] | ||
} | ||
if defined(Service['httpd']) { | ||
File['/etc/apache2/mods-available/passenger.load'] ~> Service['httpd'] | ||
File['/etc/apache2/mods-available/passenger.conf'] ~> Service['httpd'] | ||
File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['httpd'] | ||
File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['httpd'] | ||
} | ||
} | ||
|
||
class rvm::passenger::apache::disable { | ||
|
||
file { | ||
'/etc/apache2/mods-enabled/passenger.load': | ||
ensure => 'absent'; | ||
'/etc/apache2/mods-enabled/passenger.conf': | ||
ensure => 'absent'; | ||
} | ||
|
||
# Add Apache restart hooks | ||
if defined(Service['apache']) { | ||
File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['apache'] | ||
File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['apache'] | ||
} | ||
if defined(Service['apache2']) { | ||
File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['apache2'] | ||
File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['apache2'] | ||
} | ||
if defined(Service['httpd']) { | ||
File['/etc/apache2/mods-enabled/passenger.load'] ~> Service['httpd'] | ||
File['/etc/apache2/mods-enabled/passenger.conf'] ~> Service['httpd'] | ||
case $operatingsystem { | ||
Ubuntu: { include rvm::passenger::apache::ubuntu::post } | ||
CentOS: { include rvm::passenger::apache::centos::post } | ||
} | ||
} | ||
} |
Oops, something went wrong.