Skip to content
Browse files

Puppet style guide updates

  • Loading branch information...
1 parent 6d4d852 commit 07b2e7d56c7d70b585983067a2616533dc9fe4da @blt04 blt04 committed Jan 21, 2012
View
24 LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2012, Brandon Turner
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Brandon Turner nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL BRANDON TURNER BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
6 Modulefile
@@ -0,0 +1,6 @@
+name 'puppet-rvm'
+version '1.0.0'
+summary 'A puppet module for installing and using RVM (Ruby Version Manager)'
+author 'Brandon Turner <bt@brandonturner.net>'
+project_page 'https://github.com/blt04/puppet-rvm'
+license 'Modified BSD License'
View
1 VERSION
@@ -0,0 +1 @@
+1.0.0-pre
View
44 manifests/classes/dependencies-centos.pp
@@ -1,27 +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['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 } }
+ 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 } }
}
View
12 manifests/classes/passenger-centos-post.pp
@@ -10,20 +10,18 @@
$gempath,
$binpath
) {
-
exec {
'passenger-install-apache2-module':
- command => "${rvm::passenger::apache::binpath}rvm ${rvm::passenger::apache::ruby_version} exec passenger-install-apache2-module -a",
- creates => "${rvm::passenger::apache::gempath}/passenger-${rvm::passenger::apache::version}/ext/apache2/mod_passenger.so",
+ command => "${rvm::passenger::apache::binpath}rvm ${rvm::passenger::apache::ruby_version} exec passenger-install-apache2-module -a",
+ creates => "${rvm::passenger::apache::gempath}/passenger-${rvm::passenger::apache::version}/ext/apache2/mod_passenger.so",
logoutput => 'on_failure',
- require => [Rvm_gem['passenger'], Package['httpd','httpd-devel','mod_ssl']];
+ require => [Rvm_gem['passenger'], Package['httpd','httpd-devel','mod_ssl']];
}
-
+
file {
'/etc/httpd/conf.d/passenger.conf':
+ ensure => file,
content => template('rvm/passenger-apache-centos.conf.erb'),
- ensure => file,
require => Exec['passenger-install-apache2-module'];
}
-
}
View
8 manifests/classes/passenger-centos-pre.pp
@@ -1,8 +1,6 @@
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 } }
- if ! defined(Package["mod_ssl"]) { package { "mod_ssl": ensure => installed } }
-
+ if ! defined(Package['httpd']) { package { 'httpd': ensure => installed } }
+ if ! defined(Package['httpd-devel']) { package { 'httpd-devel': ensure => installed } }
+ if ! defined(Package['mod_ssl']) { package { 'mod_ssl': ensure => installed } }
}
View
2 manifests/classes/passenger-gem.pp
@@ -1,7 +1,7 @@
class rvm::passenger::gem($ruby_version, $version) {
rvm_gem {
"passenger":
- ruby_version => $ruby_version,
ensure => $version,
+ ruby_version => $ruby_version,
}
}
View
38 manifests/classes/passenger-ubuntu-post.pp
@@ -13,33 +13,33 @@
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",
+ 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']],
+ 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'];
-
+ ensure => file,
+ content => "LoadModule passenger_module ${gempath}/passenger-${version}/ext/apache2/mod_passenger.so",
+ 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'];
-
+ ensure => file,
+ content => template('rvm/passenger-apache.conf.erb'),
+ 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'];
-
+ 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'];
+ ensure => 'link',
+ target => '../mods-available/passenger.conf',
+ require => File['/etc/apache2/mods-available/passenger.conf'];
}
# Add Apache restart hooks
View
16 manifests/classes/passenger-ubuntu-pre.pp
@@ -1,12 +1,10 @@
class rvm::passenger::apache::ubuntu::pre {
# Dependencies
- if ! defined(Package['apache2']) { package { apache2: ensure => installed } }
- 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 } }
-
-
-}
+ if ! defined(Package['apache2']) { package { 'apache2': ensure => installed } }
+ 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 } }
+}
View
82 manifests/classes/passenger.pp
@@ -9,47 +9,51 @@
$spawnmethod = 'smart-lv2'
) {
- case $operatingsystem {
- Ubuntu: { include rvm::passenger::apache::ubuntu::pre }
- CentOS,RedHat: { include rvm::passenger::apache::centos::pre }
- }
-
- class {
- 'rvm::passenger::gem':
- ruby_version => $ruby_version,
- version => $version,
- }
-
- # 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/rvm/bin/rvm ${ruby_version} exec rvm gemdir`
- $gempath = "${rvm_prefix}rvm/gems/${ruby_version}/gems"
- $binpath = "${rvm_prefix}rvm/bin/"
+ case $operatingsystem {
+ Ubuntu: { include rvm::passenger::apache::ubuntu::pre }
+ CentOS,RedHat: { include rvm::passenger::apache::centos::pre }
+ }
+
+ class {
+ 'rvm::passenger::gem':
+ ruby_version => $ruby_version,
+ version => $version,
+ }
- case $operatingsystem {
- Ubuntu: { class {'rvm::passenger::apache::ubuntu::post':
- ruby_version => $ruby_version,
- version => $version,
- rvm_prefix => $rvm_prefix,
- mininstances => $mininstances,
- maxpoolsize => $maxpoolsize,
- poolidletime => $poolidletime,
+ # 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/rvm/bin/rvm ${ruby_version} exec rvm gemdir`
+ $gempath = "${rvm_prefix}rvm/gems/${ruby_version}/gems"
+ $binpath = "${rvm_prefix}rvm/bin/"
+
+ case $operatingsystem {
+ Ubuntu: {
+ class { 'rvm::passenger::apache::ubuntu::post':
+ ruby_version => $ruby_version,
+ version => $version,
+ rvm_prefix => $rvm_prefix,
+ mininstances => $mininstances,
+ maxpoolsize => $maxpoolsize,
+ poolidletime => $poolidletime,
maxinstancesperapp => $maxinstancesperapp,
- spawnmethod => $spawnmethod,
- gempath => $gempath,
- binpath => $binpath;
- } }
- CentOS,RedHat: { class {'rvm::passenger::apache::centos::post':
- ruby_version => $ruby_version,
- version => $version,
- rvm_prefix => $rvm_prefix,
- mininstances => $mininstances,
- maxpoolsize => $maxpoolsize,
- poolidletime => $poolidletime,
+ spawnmethod => $spawnmethod,
+ gempath => $gempath,
+ binpath => $binpath;
+ }
+ }
+ CentOS,RedHat: {
+ class { 'rvm::passenger::apache::centos::post':
+ ruby_version => $ruby_version,
+ version => $version,
+ rvm_prefix => $rvm_prefix,
+ mininstances => $mininstances,
+ maxpoolsize => $maxpoolsize,
+ poolidletime => $poolidletime,
maxinstancesperapp => $maxinstancesperapp,
- spawnmethod => $spawnmethod,
- gempath => $gempath,
- binpath => $binpath;
- } }
+ spawnmethod => $spawnmethod,
+ gempath => $gempath,
+ binpath => $binpath;
+ }
}
+ }
}
View
1 manifests/classes/system.pp
@@ -10,5 +10,4 @@
Class['rvm::dependencies'],
],
}
-
}
View
17 manifests/definitions/system_user.pp
@@ -1,13 +1,12 @@
-
define rvm::system_user () {
- $username = $title
- $group = $operatingsystem ? {
- default => 'rvm',
- }
+ $username = $title
+ $group = $operatingsystem ? {
+ default => 'rvm',
+ }
- exec { "/usr/sbin/usermod -a -G $group $username":
- unless => "/bin/cat /etc/group | grep $group | grep $username",
- require => [User[$username], Exec['system-rvm']];
- }
+ exec { "/usr/sbin/usermod -a -G $group $username":
+ unless => "/bin/cat /etc/group | grep $group | grep $username",
+ require => [User[$username], Exec['system-rvm']];
+ }
}
View
14 templates/passenger-apache-centos.conf.erb
@@ -1,11 +1,11 @@
LoadModule passenger_module <%= gempath %>/passenger-<%= version %>/ext/apache2/mod_passenger.so
<IfModule passenger_module>
- PassengerRoot <%= gempath %>/passenger-<%= version %>
- PassengerRuby <%= rvm_prefix %>rvm/wrappers/<%= ruby_version %>/ruby
- PassengerMaxPoolSize <%= maxpoolsize %>
- PassengerPoolIdleTime <%= poolidletime %>
- PassengerMinInstances <%= mininstances %>
- PassengerMaxInstancesPerApp <%= maxinstancesperapp %>
- PassengerSpawnMethod <%= spawnmethod %>
+ PassengerRoot <%= gempath %>/passenger-<%= version %>
+ PassengerRuby <%= rvm_prefix %>rvm/wrappers/<%= ruby_version %>/ruby
+ PassengerMaxPoolSize <%= maxpoolsize %>
+ PassengerPoolIdleTime <%= poolidletime %>
+ PassengerMinInstances <%= mininstances %>
+ PassengerMaxInstancesPerApp <%= maxinstancesperapp %>
+ PassengerSpawnMethod <%= spawnmethod %>
</IfModule>
View
14 templates/passenger-apache.conf.erb
@@ -1,9 +1,9 @@
<IfModule passenger_module>
- PassengerRoot <%= gempath %>/passenger-<%= version %>
- PassengerRuby <%= rvm_prefix %>rvm/wrappers/<%= ruby_version %>/ruby
- PassengerMaxPoolSize <%= maxpoolsize %>
- PassengerPoolIdleTime <%= poolidletime %>
- PassengerMinInstances <%= mininstances %>
- PassengerMaxInstancesPerApp <%= maxinstancesperapp %>
- PassengerSpawnMethod <%= spawnmethod %>
+ PassengerRoot <%= gempath %>/passenger-<%= version %>
+ PassengerRuby <%= rvm_prefix %>rvm/wrappers/<%= ruby_version %>/ruby
+ PassengerMaxPoolSize <%= maxpoolsize %>
+ PassengerPoolIdleTime <%= poolidletime %>
+ PassengerMinInstances <%= mininstances %>
+ PassengerMaxInstancesPerApp <%= maxinstancesperapp %>
+ PassengerSpawnMethod <%= spawnmethod %>
</IfModule>

0 comments on commit 07b2e7d

Please sign in to comment.
Something went wrong with that request. Please try again.