Giter VIP home page Giter VIP logo

vagrant-sprinkle's Introduction

vagrant-sprinkle

A Vagrant plugin to provision virtual machines with Sprinkle.

Installation

$ vagrant plugin install vagrant-sprinkle

Usage

In the Vagrantfile

Use :sprinkle as the provisioner in your Vagrantfile:

Vagrant.configure('2') do |config|
  config.vm.provision(:sprinkle) do |sprinkle|
    sprinkle.script = 'sprinkle.rb'
    sprinkle.cloud = true
  end
end

The only required option is script, which should be a relative path to your Sprinkle install script. An example Vagrantfile is provided in the root of the repository.

In the Sprinkle script

Set the SSH options for deploy in accordance with the details provided by vagrant ssh-config:

deployment do
  delivery :capistrano do
    role :vagrant, "127.0.0.1"
    set :user, "vagrant"
    ssh_options[:keys] = ["#{ENV['HOME']}/.vagrant.d/insecure_private_key"]
    ssh_options[:port] = 2222
  end
end

An example sprinkle.rb is provided in the root of the repository.

Options

The following options can be set on the sprinkle config object (the block parameter).

  • script (String, required): Relative path to a Sprinkle script to run.
  • only (String): Only run sprinkle policies for the specified role.
  • test (Boolean): Process, but don't perform any actions.
  • verbose (Boolean): Provide verbose output.
  • cloud (Boolean): Show powder cloud, i.e. package hierarchy and installation order.
  • force (Boolean): Force installation of all packages, even if already installed.

License

MIT

vagrant-sprinkle's People

Contributors

jimmycuadra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

priithaamer

vagrant-sprinkle's Issues

sprinkle.only option does not seem to work

Doing this:

config.vm.provision(:sprinkle) do |sprinkle|
  sprinkle.only = 'my_role'
end

Raises an error:

~/.vagrant.d/gems/gems/sprinkle-0.7.6.2/bin/sprinkle:62:in `block in <top (required)>': invalid option: --only edicy_db_backup (OptionParser::InvalidOption)

I managed to get it working by changing the line 19 in provisioner.rb like this:

options << "--only=#{config.only}" if config.only

If you confirm this would be an acceptable change i'll do a PR.

Dependency on vagrant in Gemfile

The Gemfile has gem 'vagrant', but the plugin packaging docs say:

Do not depend on Vagrant for your gem. Vagrant is no longer distributed as a gem, and you can assume that it will always be available when your plugin is installed.

Is there any reason to keep the dependency?

Installation of plugin under Windows 10 doesnt work

Cant get the sprinkle provisioner to work in my Vagrantfile under Windows 10.

I was expecting the plugin install to do everything but even with installing sprinkle explicitly under vagrant/embedded it still doesnt work.

There seems to be gems everywhere, which is confusing to me. Any ideas wha's wrong?

Step 1

vagrant plugin install vagrant-sprinkle

installed under

C:\Users\Craig\.vagrant.d\gems\2.3.4\gems

Vagrantfile

          development.vm.provision(:sprinkle) do |sprinkle|
            sprinkle.script = '../sprinkle/setup_vm.rb'
            sprinkle.cloud = true
            sprinkle.verbose = true
          end

vagrant up

==> vm: Running provisioner: sprinkle...
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'sprinkle' (>= 0) among 46 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=C:/HashiCorp/Vagrant/embedded/gems', execute `gem env` for more information
        from C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:320:in `to_spec'
        from C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
        from C:/Ruby200-x64/bin/sprinkle:22:in `<main>'	

gem env

RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.2
  - RUBY VERSION: 2.3.4 (2017-03-30 patchlevel 301) [x64-mingw32]
  - INSTALLATION DIRECTORY: C:/HashiCorp/Vagrant/embedded/gems
  - USER INSTALLATION DIRECTORY: C:/Users/Craig/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: C:/HashiCorp/Vagrant/embedded/mingw64/bin/ruby.exe
  - EXECUTABLE DIRECTORY: C:/HashiCorp/Vagrant/embedded/gems/bin
  - SPEC CACHE DIRECTORY: C:/Users/Craig/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: C:/ProgramData
  - RUBYGEMS PLATFORMS:
    - ruby
    - x64-mingw32
  - GEM PATHS:
     - C:/HashiCorp/Vagrant/embedded/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - C:\HashiCorp\Vagrant\embedded\mingw64\bin
     - C:\HashiCorp\Vagrant\embedded\usr\bin

Step 2

Install sprinkle gem in vagrant's embedded Ruby as Admin user

`C:\HashiCorp\Vagrant\embedded\mingw64\bin\gem install sprinkle`

which installs to

`C:\HashiCorp\Vagrant\embedded\mingw64\lib\ruby\gems\2.3.0\gems`

vagrant up

	c:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem sprinkle (>= 0.a) (Gem::GemNotFoundException)
        from C:/HashiCorp/Vagrant/embedded/mingw64/bin/sprinkle:24:in `<main>'

Step 3

Copy sprinkle.rb from C:\HashiCorp\Vagrant\embedded\mingw64\lib\ruby\gems\2.3.0\gems to

`C:\HashiCorp\Vagrant\embedded\gems\gems`

Copy sprinkle-0.7.7.gemspec from C:\HashiCorp\Vagrant\embedded\mingw64\lib\ruby\gems\2.3.0\specifications to

`C:\HashiCorp\Vagrant\embedded\gems\specifications`

vagrant up

c:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- active_support/all (LoadError)
        from c:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/sprinkle-0.7.7/lib/sprinkle.rb:2:in `<top (required)>'
        from c:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from c:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/HashiCorp/Vagrant/embedded/gems/gems/sprinkle-0.7.7/bin/sprinkle:96:in `<top (required)>'
        from C:/HashiCorp/Vagrant/embedded/mingw64/bin/sprinkle:26:in `load'
        from C:/HashiCorp/Vagrant/embedded/mingw64/bin/sprinkle:26:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.