Skip to content

Instantly share code, notes, and snippets.

@blahutka
Created August 23, 2011 19:10
Show Gist options
  • Save blahutka/1166177 to your computer and use it in GitHub Desktop.
Save blahutka/1166177 to your computer and use it in GitHub Desktop.
Vagrant - Sprinkle provisioner
module Vagrant
module Provisioners
class Sprinkle < Base
register :sprinkle
class Config < Vagrant::Config::Base
attr_accessor :cookbooks_path
end
def prepare
env.ui.info "Path cookbooks: " + config.cookbooks_path
end
def provision!
env.ui.info "Path cookbooks: " + config.cookbooks_path
commands = ['apt-get install -y ruby rubygems', 'gem install i18n sprinkle --no-rdoc --no-ri']
commands << "sprinkle -c -s #{config.cookbooks_path}"
vm.ssh.execute do |ssh|
ssh.sudo! commands do |ch, type, data|
if type == :exit_status
ssh.check_exit_status(data, commands)
else
env.ui.info(data)
end
end
end
end
end
end
end
# Vagrantfile
#
# Vagrant::Config.run do |config|
# config.vm.provision :sprinkle do |sprinkle|
# sprinkle.cookbooks_path = '/sprinkle-cook/install.rb'
# end
#
# config.vm.share_folder "sprinkle-cook", "/sprinkle-cook", "../../my-gems/sprinkle-cook"
# end
# Sprinkle install.rb file (local actor)
# ... setup
# deployment do
# # mechanism for deployment
# delivery :local do
# begin
# recipes 'Capfile'
# recipes "config/deploy/#{fetch(:stage, :development)}"
# rescue LoadError
# recipes 'deploy'
# end
# end
# source based package installer defaults
# source do
# prefix '/usr/local'
# archives '/usr/local/sources'
# builds '/usr/local/build'
# end
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment