Skip to content

Instantly share code, notes, and snippets.

View big-samantha's full-sized avatar

Samantha Smith big-samantha

View GitHub Profile
# Install pear via package, and install necessary modules.
class manage_pear {
include
'pear',
'manage_pear::packages'
package { 'php5-dev' :
ensure => present,
}
}
class pear::packages {
exec { 'pecl-mongodb' :
path => ['/usr/local/sbin','/usr/local/bin','/usr/sbin','/usr/bin','/sbin:/bin'],
}
}
#extensionname should be the file to load in the ini, e.g. mongo.so
define pear::installpackage (
$packagename = $title,
$packageversion,
class pear::packages {
exec { 'pecl-mongodb' :
path => ['/usr/local/sbin','/usr/local/bin','/usr/sbin','/usr/bin','/sbin:/bin'],
}
}
#extensionname should be the file to load in the ini, e.g. mongo.so
define pear::installpackage (
$packagename = $title,
$packageversion,
#extensionname should be the file to load in the ini, e.g. mongo.so
define pear::installpackage (
$packagename = $title,
$packageversion,
$extensionname,
$execpath = ['/usr/local/sbin','/usr/local/bin','/usr/sbin','/usr/bin','/sbin','/bin'],
$execuser = 'root'
) {
exec { "${packagename}-${packageversion}":
command => "/usr/bin/pear install ${packagename}-$packageversion",
#extensionname should be the file to load in the ini, e.g. mongo.so
define pear::installpackage (
$packagename = $title,
$packageversion,
$extensionname,
$execpath = ['/usr/local/sbin','/usr/local/bin','/usr/sbin','/usr/bin','/sbin','/bin'],
$execuser = 'root'
) {
exec { "${packagename}-${packageversion}":
command => "/usr/bin/pear install ${packagename}-$packageversion",
#wooo we're making a function
def convert_feet_to_meters(number_of_feet)
puts "You have #{number_of_feet} feet."
number_of_meters = number_of_feet * 0.3048
puts "That's equal to #{number_of_meters} meters!"
end
convert_feet_to_meters(3)
##../modules/haproxy/init.pp
class haproxy {
include
'::haproxy::install',
'::haproxy::config',
'::haproxy::service'
Class['::haproxy::install'] -> Class['::haproxy::config']
Class['::haproxy::config'] ~> Class['::haproxy::service']
}
# configure haproxy
class haproxy::config ( $haproxycfg ) {
file { 'haproxy.cfg':
ensure => present,
content => $haproxycfg,
path => '/etc/haproxy/haproxy.cfg',
owner => root,
}
}
# Install and configure haproxy.
class haproxy ($haproxycfg) {
include
'::haproxy::install',
'::haproxy::config',
'::haproxy::service'
Class['::haproxy::install'] -> Class['::haproxy::config']
Class['::haproxy::config'] ~> Class['::haproxy::service']
}
# configure haproxy
class haproxy::config inherits ::haproxy {
file { 'haproxy.cfg':
ensure => present,
content => $haproxycfg,
path => '/etc/haproxy/haproxy.cfg',
owner => root,
}
}