diff --git a/shared/additional-modules/god/manifests/init.pp b/shared/additional-modules/god/manifests/init.pp index c83a663..2c461b7 100644 --- a/shared/additional-modules/god/manifests/init.pp +++ b/shared/additional-modules/god/manifests/init.pp @@ -2,10 +2,10 @@ class god { gem { 'god': path => "${ruby::path}:${base::path}", ensure => present, - require => Make_and_install['ruby'] + require => Class['ruby'] } - $bin = "${base::install_path}/ruby/bin/god" + $bin = "${ruby::path}//god" $dir = config_path("god.d") $pid = pid_path($name) $log = log_path($name) diff --git a/shared/additional-modules/ruby/manifests/init.pp b/shared/additional-modules/ruby/manifests/init.pp index b58de4f..ec9d823 100644 --- a/shared/additional-modules/ruby/manifests/init.pp +++ b/shared/additional-modules/ruby/manifests/init.pp @@ -1,38 +1,49 @@ -class ruby($version, $configure = "--disable-install-doc", $build_path = '') { - $path = bin_path($name) - $with_ruby_path = "${path}:${base::path}" - - build_and_install { $name: - version => $version, - source => "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-<%= version %>.tar.gz", - configure => $configure, - preconfigure => "LDFLAGS='-rdynamic -Wl,-export-dynamic'", - path => "${build_path}:${with_ruby_path}" - } - - if ($osfamily == 'debian') { - $packages = [ - 'libyaml-dev', 'libreadline-dev', 'libssl-dev', 'libffi-dev', - 'libncurses5-dev', 'libcurl4-openssl-dev', 'zlib1g-dev', - 'libxml2', 'libxml2-dev', 'libxslt1.1', 'libxslt1-dev' - ] - - package { $packages: - ensure => installed, - before => Build_and_install[$name] - } - - bash_rc_d { 'ruby': - ensure => present, - path => $base::local_path, - require => Build_and_install[$name] - } - } - +class ruby($version, $deb_url = '', $configure = "--disable-install-doc", $build_path = '') { gem { [ 'bundler', 'penchant' ]: - require => Build_and_install[$name], - path => $with_ruby_path, + path => "${path}:${base::path}", ensure => present } + + if ($deb_url) { + $path = '/usr/bin' + + remotedeb { ruby: + url => $deb_url, + version => $version + } + + Remotedeb[ruby] -> Gem['bundler', 'penchant'] + } else { + $path = bin_path($name) + + build_and_install { $name: + version => $version, + source => "http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-<%= version %>.tar.gz", + configure => $configure, + preconfigure => "LDFLAGS='-rdynamic -Wl,-export-dynamic'", + path => "${build_path}:${with_ruby_path}" + } + + if ($osfamily == 'debian') { + $packages = [ + 'libyaml-dev', 'libreadline-dev', 'libssl-dev', 'libffi-dev', + 'libncurses5-dev', 'libcurl4-openssl-dev', 'zlib1g-dev', + 'libxml2', 'libxml2-dev', 'libxslt1.1', 'libxslt1-dev' + ] + + package { $packages: + ensure => installed, + before => Build_and_install[$name] + } + + bash_rc_d { 'ruby': + ensure => present, + path => $base::local_path, + require => Build_and_install[$name] + } + } + + Build_and_install[ruby] -> Gem['bundler', 'penchant'] + } } diff --git a/shared/modules/debsource/manifests/init.pp b/shared/modules/debsource/manifests/init.pp new file mode 100644 index 0000000..31f5895 --- /dev/null +++ b/shared/modules/debsource/manifests/init.pp @@ -0,0 +1,23 @@ +define debsource($apt_source, $keyfile = '', $host = '', $hash = '') { + $file = "/etc/apt/sources.list.d/${name}.list" + file { $file: content => $apt_source } + + if ($host != '') { + exec { "debsource-${name}": + command => "apt-key adv --keyserver ${host} --recv ${hash} && apt-get update", + unless => "test $(apt-key list | grep ${hash} | wc -l) -ne 0", + path => $base::path, + require => File[$file] + } + } + + if ($keyfile != '') { + exec { "debsource-${name}": + command => "curl $keyfile | apt-key add -", + path => $base::path, + require => File[$file], + unless => "test $(apt-key list | grep ${hash} | wc -l) -ne 0" + } + } +} + diff --git a/shared/modules/remotedeb/manifests/init.pp b/shared/modules/remotedeb/manifests/init.pp new file mode 100644 index 0000000..ba5b220 --- /dev/null +++ b/shared/modules/remotedeb/manifests/init.pp @@ -0,0 +1,10 @@ +define remotedeb($url, $version) { + $deb = "/tmp/${name}.deb" + + exec { "remotedeb-${name}": + command => "curl -o ${deb} ${url} && dpkg -i ${deb}", + unless => "test $(dpkg -l ${name} | grep ${version} | wc -l) -ne 0", + path => $base::path + } +} + diff --git a/skel/apply.erb b/skel/apply.erb index 9e88d4d..6eb7503 100644 --- a/skel/apply.erb +++ b/skel/apply.erb @@ -1,7 +1,7 @@ #!/bin/bash mkdir -p ~/.puppet -<%= use_sudo ? "sudo env" : "" %> RUBYLIB="${PWD}/shared/lib" \ +<%= use_sudo ? "sudo env" : "" %> RUBYLIB="${PWD}/lib:${PWD}/shared/lib" \ <%= with_additional_puppet_bin_path %> \ puppet apply <%= additional_puppet_options %> \ --confdir=$PWD \