a ton of stuff

This commit is contained in:
John Bintz 2011-12-08 08:58:22 -05:00
parent 6abf601231
commit 64c306bed8
9 changed files with 43 additions and 1 deletions

6
README.md Normal file
View File

@ -0,0 +1,6 @@
My Puppet stuff, all collected together into one gem. Uses
Capistrano to deploy to a remote server and execute the
configs.
`require "puppet-standalone-mashup/capistrano"`

View File

@ -20,6 +20,10 @@ module Puppet
def sbin_path(install_path, name) def sbin_path(install_path, name)
File.join(install_path, name, 'sbin') File.join(install_path, name, 'sbin')
end end
def pid_path(pid_path, name)
File.join(pid_path, "#{name}.pid")
end
end end
end end
end end
@ -27,3 +31,4 @@ end
class Puppet::Parser::Scope class Puppet::Parser::Scope
include Puppet::Modules::CommonDirectories include Puppet::Modules::CommonDirectories
end end

View File

@ -0,0 +1,8 @@
require 'puppet/modules/common_directories'
module Puppet::Parser::Functions
newfunction(:pid_path, :type => :rvalue) do |args|
pid_path(lookupvar('base::pid_path'), *args)
end
end

View File

@ -4,7 +4,7 @@ Puppet::Type.type(:make_and_install).provide(:action) do
desc "Configure a program to install" desc "Configure a program to install"
def create def create
system %{bash -c 'cd #{@resource[:build_path]} ; make && make install'} system %{bash -c '#{path} cd #{@resource[:build_path]} ; make && make install'}
File.symlink(@resource[:install_path], symlink_path) File.symlink(@resource[:install_path], symlink_path)
end end
@ -21,4 +21,8 @@ Puppet::Type.type(:make_and_install).provide(:action) do
def symlink_path def symlink_path
File.join(File.dirname(@resource[:install_path]), @resource[:name]) File.join(File.dirname(@resource[:install_path]), @resource[:name])
end end
def path
@resource[:path].empty? ? '' : "export PATH=#{@resource[:path]}:$PATH ; "
end
end end

View File

@ -18,5 +18,9 @@ Puppet::Type.newtype(:make_and_install) do
newparam(:options) do newparam(:options) do
desc "Options to build the software" desc "Options to build the software"
end end
newparam(:path) do
desc "Binary path to add"
end
end end

View File

@ -23,6 +23,7 @@ define build_and_install($version, $source, $path = '', $configure = '') {
make_and_install { $name: make_and_install { $name:
build_path => $build_path, build_path => $build_path,
install_path => $install_path, install_path => $install_path,
path => $path,
require => Configure[$name], require => Configure[$name],
ensure => present ensure => present
} }

View File

@ -0,0 +1,4 @@
define installed_package {
package { $name: ensure => installed }
}

View File

@ -0,0 +1,3 @@
define running_service {
service { $name: ensure => running }
}

View File

@ -0,0 +1,7 @@
define update_rc_d_defaults {
exec { "update-rc.d-${name}":
command => "update-rc.d ${name} defaults",
path => $base::path
}
}