Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made install from URL optional.

  • Loading branch information...
commit d81cebaa7292d9799244db68108a889aee04c3a6 1 parent 38bafca
James Martin authored
View
1  .project
@@ -3,7 +3,6 @@
<name>puppet-riak</name>
<comment></comment>
<projects>
- <project>puppet-stdlib</project>
</projects>
<buildSpec>
<buildCommand>
View
2  Vagrantfile
@@ -24,7 +24,7 @@ Vagrant::Config.run do |config|
config.vbguest.auto_update = false
# specify all Riak VMs:
- nodes = 3
+ nodes = 1
baseip = 5
(1..nodes).each do |n|
ip = "10.42.0.#{baseip + n.to_i}"
View
70 manifests/config.pp
@@ -7,7 +7,8 @@
# a "status" parameter, yet. Working around that for now.
class riak::config(
- $absent = false
+ $absent = false,
+ $manage_repos = true
) {
$package_repo_type = $::operatingsystem ? {
@@ -26,40 +27,41 @@
default => 'present'
}
-
+ if $manage_repos == true {
case $package_repo_type {
- 'apt': {
- file {
- 'apt-basho':
- path => '/etc/apt/sources.list.d/basho.list',
- content => "deb http://apt.basho.com ${lsbdistcodename} main\n",
- ensure => $manage_apt_repo
- }
- package {
- 'curl' : ensure => installed
- }
- exec {
- 'add-basho-key':
- command => '/usr/bin/curl http://apt.basho.com/gpg/basho.apt.key | /usr/bin/apt-key add -',
- unless => '/usr/bin/apt-key list | /bin/grep -q "Basho Technologies"',
- require => [ Package['curl']]
- }
- exec {
- 'apt-get-update':
- command => '/usr/bin/apt-get update',
- subscribe => File['apt-basho'],
- refreshonly => true
- }
+ 'apt': {
+ file {
+ 'apt-basho':
+ path => '/etc/apt/sources.list.d/basho.list',
+ content => "deb http://apt.basho.com ${lsbdistcodename} main\n",
+ ensure => $manage_apt_repo
+ }
+ package {
+ 'curl' : ensure => installed
+ }
+ exec {
+ 'add-basho-key':
+ command => '/usr/bin/curl http://apt.basho.com/gpg/basho.apt.key | /usr/bin/apt-key add -',
+ unless => '/usr/bin/apt-key list | /bin/grep -q "Basho Technologies"',
+ require => [ Package['curl']]
+ }
+ exec {
+ 'apt-get-update':
+ command => '/usr/bin/apt-get update',
+ subscribe => File['apt-basho'],
+ refreshonly => true
+ }
}
- 'yum': {
- yumrepo {
- 'basho-products':
- descr => "basho packages for \$releasever-\$basearch",
- baseurl => "http://yum.basho.com/el/6/products/\$basearch",
- gpgcheck => 1,
- enabled => $manage_yum_repo,
- gpgkey => "http://yum.basho.com/gpg/RPM-GPG-KEY-basho"
- }
+ 'yum': {
+ yumrepo {
+ 'basho-products':
+ descr => "basho packages for \$releasever-\$basearch",
+ baseurl => "http://yum.basho.com/el/6/products/\$basearch",
+ gpgcheck => 1,
+ enabled => $manage_yum_repo,
+ gpgkey => "http://yum.basho.com/gpg/RPM-GPG-KEY-basho"
+ }
}
}
-}
+ }
+}
View
45 manifests/init.pp
@@ -72,8 +72,12 @@
class riak(
$version = hiera('version', $riak::params::version),
$package = hiera('package', $riak::params::package),
+ $download = hiera('download', $riak::params::download),
+ $use_repos = hiera('use_repos', $riak::params::use_repos),
+ $download_hash = hiera('download_hash', $riak::params::download_hash),
$source = hiera('source', ''),
$template = hiera('template', ''),
+ $architecture = hiera('architecture', $riak::params::architecture),
$log_dir = hiera('log_dir', $riak::params::log_dir),
$erl_log_dir = hiera('erl_log_dir', $riak::params::erl_log_dir),
$etc_dir = hiera('etc_dir', $riak::params::etc_dir),
@@ -91,6 +95,8 @@
include stdlib
+ $pkgfile = "/tmp/${$package}-${$version}.${$riak::params::package_type}"
+
File {
owner => 'root',
group => 'root',
@@ -132,21 +138,43 @@
}
anchor { 'riak::start': } ->
+##this should be encapsulated in the case statement as well
+
+ #notify { 'url':
+ # message => "Downloaded file from ##${download}/${download_hash}##",
+ #}
package { $riak::params::deps:
ensure => $manage_package
}
+ if $use_repos == true {
- package { 'riak':
- ensure => $manage_package,
- require => [
- Class[riak::config],
- Package[$riak::params::deps]
- ]
+ package { 'riak':
+ ensure => $manage_package,
+ require => [
+ Class[riak::config],
+ Package[$riak::params::deps]
+ ]
+ }
+ }
+ else {
+ httpfile { $pkgfile:
+ ensure => present,
+ source => $download,
+ hash => $download_hash
+ }
+ package { 'riak':
+ ensure => $manage_package,
+ source => $pkgfile,
+ provider => $riak::params::package_provider,
+ require => [
+ Httpfile[$pkgfile],
+ Package[$riak::params::deps]
+ ]
+ }
}
-
file { $etc_dir:
ensure => directory,
@@ -163,7 +191,8 @@
}
class { 'riak::config':
- absent => $absent
+ absent => $absent,
+ manage_repos => $use_repos
}
View
24 manifests/params.pp
@@ -19,7 +19,31 @@
default => []
}
+ $package_type = $::operatingsystem ? {
+ /(?i:centos|redhat)/ => 'rpm',
+ default => 'deb'
+ }
+
+ $package_provider = $::operatingsystem ? {
+ /(?i:centos|redhat)/ => 'rpm',
+ default => 'dpkg'
+ }
+
+ $architecture = $::operatingsystem ? {
+ /(?i:centos|redhat)/ => 'x86_64',
+ default => 'amd64'
+ }
+
$version = '1.2.0'
+ $use_repos = true
+ $get = $::operatingsystem ? {
+ /(?i:centos|redhat)/ => "/riak/CURRENT/rhel/6/riak-${version}-1.el6.${architecture}.${package_type}",
+ default => "/riak/CURRENT/ubuntu/precise/riak_${version}-1_${architecture}.${package_type}"
+ }
+
+ $download = "http://downloads.basho.com.s3-website-us-east-1.amazonaws.com${get}"
+
+ $download_hash = "${download}.sha"
$error_log = "${log_dir}/error.log"
$info_log = "${log_dir}/console.log"
Please sign in to comment.
Something went wrong with that request. Please try again.