Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added some shell commands to use hiera properly. Vagrant file

uses centos as default since riak debian/ubuntu script is broken
until riak 1.2.1.
  • Loading branch information...
commit 38bafcad3269f87f388032b3ffe1f90aa86511c3 1 parent fe1e9e2
James Martin authored
View
10 Vagrantfile
@@ -6,12 +6,12 @@ require 'fileutils'
Vagrant::Config.run do |config|
# choices for virtual machines:
- config.vm.box = 'precise64'
- config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
+ #config.vm.box = 'precise64'
+ #config.vm.box_url = 'http://files.vagrantup.com/precise64.box'
#config.vm.box = 'debian-6.0'
#config.vm.box_url = 'http://puppetlabs.s3.amazonaws.com/pub/Squeeze64.box'
- #config.vm.box = 'centos-6.3-64bit'
- #config.vm.box_url = 'https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box'
+ config.vm.box = 'centos 6.3'
+ config.vm.box_url = 'https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box'
config.vm.share_folder 'riak-module', "#{FileUtils.pwd}", "."
@@ -36,6 +36,8 @@ Vagrant::Config.run do |config|
# give all nodes a little bit more memory:
cfg.vm.customize ["modifyvm", :id, "--memory", 1024]
+ #get those gems installed
+ cfg.vm.provision :shell, :path => "shellprovision/bootstrap.sh"
# specify puppet for provisioning
cfg.vm.provision :puppet do |puppet|
puppet.manifests_path = File.join 'spec', 'fixtures', 'manifests'
View
72 manifests/config.pp
@@ -1,31 +1,65 @@
# == Class: riak::config
# Doing some fun stuff such as setting up the repositories
+# in the case of centos / rhel, this assumes you haven't installed
+# the basho-release-*.rpm.
+# there is a bug in our debian startup script -- it doesn't have
+# a "status" parameter, yet. Working around that for now.
-class riak::config{
+class riak::config(
+ $absent = false
+) {
$package_repo_type = $::operatingsystem ? {
/(?i:centos|redhat)/ => 'yum',
/(?i:debian|ubuntu)/ => 'apt'
}
- 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"
- }
- 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 "Basho Technologies"',
- require => [ Package['curl']]
- }
-
- }
+
+ $manage_yum_repo = $absent ? {
+ true => 'absent',
+ default => '1'
+ }
+
+ $manage_apt_repo = $absent ? {
+ true => 'absent',
+ default => 'present'
}
+
+
+ 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
+ }
+ }
+ '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
10 manifests/init.pp
@@ -79,6 +79,7 @@
$etc_dir = hiera('etc_dir', $riak::params::etc_dir),
$data_dir = hiera('data_dir', $riak::params::data_dir),
$service_autorestart = hiera('service_autorestart',
+
$riak::params::service_autorestart
),
$cfg = hiera_hash('cfg', {}),
@@ -89,7 +90,6 @@
) inherits riak::params {
include stdlib
- include riak::config
File {
owner => 'root',
@@ -134,7 +134,6 @@
anchor { 'riak::start': } ->
-
package { $riak::params::deps:
ensure => $manage_package
}
@@ -163,6 +162,11 @@
notify => $manage_service_autorestart
}
+ class { 'riak::config':
+ absent => $absent
+ }
+
+
class { 'riak::vmargs':
absent => $absent,
cfg => $vmargs_cfg,
@@ -184,10 +188,10 @@
service { 'riak':
ensure => $manage_service_ensure,
enable => $manage_service_enable,
- status => 'riak-admin test',
require => [
Class['riak::appconfig'],
Class['riak::vmargs'],
+ Class['riak::config'],
User['riak'],
Package['riak']
],
View
2  manifests/params.pp
@@ -21,7 +21,7 @@
$version = '1.2.0'
- $error_log = "${log_dir}/error.log"
+ $error_log = "${log_dir}/error.log"
$info_log = "${log_dir}/console.log"
$crash_log = "${log_dir}/crash.log"
View
3  shellprovision/bootstrap.sh
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+gem install hiera hiera-puppet
Please sign in to comment.
Something went wrong with that request. Please try again.