vagrant-librarian-puppet-0.9.2/0000755000175000017500000000000013530570147016305 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/vagrant-librarian-puppet.gemspec0000644000175000017500000000230613530570147024571 0ustar gabstergabster# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'vagrant-librarian-puppet/version' Gem::Specification.new do |spec| spec.name = "vagrant-librarian-puppet" spec.version = VagrantPlugins::LibrarianPuppet::VERSION spec.authors = ["Michael Hahn"] spec.email = ["mwhahn@gmail.com"] spec.description = %q{A Vagrant plugin to install Puppet modules using Librarian-Puppet.} spec.summary = %q{A Vagrant plugin to install Puppet modules using Librarian-Puppet.} spec.homepage = "https://github.com/mhahn/vagrant-librarian-puppet" spec.license = "MIT" spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_runtime_dependency "librarian-puppet", "~> 2.2.1" # vagrant 1.8.x vendors ruby 2.2.x which requires puppet >= 4 spec.add_runtime_dependency "puppet", "~> 4.3.2" spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" end vagrant-librarian-puppet-0.9.2/puppet_custom/0000755000175000017500000000000013530570147021214 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/puppet_custom/modules/0000755000175000017500000000000013530570147022664 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/puppet_custom/modules/.gitkeep0000644000175000017500000000000013530570147024303 0ustar gabstergabstervagrant-librarian-puppet-0.9.2/puppet_custom/Puppetfile0000644000175000017500000000016513530570147023256 0ustar gabstergabster# Manage Puppet module dependencies with librarian-puppet forge 'http://forge.puppetlabs.com' mod 'puppetlabs/ntp' vagrant-librarian-puppet-0.9.2/puppet/0000755000175000017500000000000013530570147017622 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/puppet/modules/0000755000175000017500000000000013530570147021272 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/puppet/modules/.gitkeep0000644000175000017500000000000013530570147022711 0ustar gabstergabstervagrant-librarian-puppet-0.9.2/puppet/Puppetfile0000644000175000017500000000030613530570147021661 0ustar gabstergabster# Manage Puppet module dependencies with librarian-puppet forge 'http://forge.puppetlabs.com' mod 'supervisor', :git => 'git://github.com/eventbrite/puppet-supervisor.git' mod 'puppetlabs/git' vagrant-librarian-puppet-0.9.2/lib/0000755000175000017500000000000013530570147017053 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/lib/vagrant-librarian-puppet/0000755000175000017500000000000013530570147023771 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/lib/vagrant-librarian-puppet/version.rb0000644000175000017500000000011713530570147026002 0ustar gabstergabstermodule VagrantPlugins module LibrarianPuppet VERSION = "0.9.2" end end vagrant-librarian-puppet-0.9.2/lib/vagrant-librarian-puppet/plugin.rb0000644000175000017500000000133113530570147025612 0ustar gabstergabsterbegin require "vagrant" rescue LoadError abort "vagrant-librarian-puppet must be loaded in a Vagrant environment." end require "vagrant-librarian-puppet/action/librarian_puppet" module VagrantPlugins module LibrarianPuppet class Plugin < Vagrant.plugin("2") name "vagrant-librarian-puppet" description <<-DESC A Vagrant plugin to install Puppet modules using Librarian-Puppet. DESC action_hook "librarian_puppet" do |hook| # XXX see if we can only hook so long as a command option isn't passed hook.before Vagrant::Action::Builtin::Provision, Action::Install end config "librarian_puppet" do require_relative "config" Config end end end end vagrant-librarian-puppet-0.9.2/lib/vagrant-librarian-puppet/config.rb0000644000175000017500000000254113530570147025565 0ustar gabstergabstermodule VagrantPlugins module LibrarianPuppet class Config < Vagrant.plugin(2, :config) attr_accessor :puppetfile_dir attr_accessor :use_v1_api attr_accessor :destructive attr_accessor :placeholder_filename attr_accessor :resolve_options def initialize @puppetfile_dir = UNSET_VALUE @placeholder_filename = UNSET_VALUE @use_v1_api = UNSET_VALUE @destructive = UNSET_VALUE @resolve_options = UNSET_VALUE end def finalize! @puppetfile_dir = '.' if @puppetfile_dir == UNSET_VALUE @placeholder_filename = '.PLACEHOLDER' if @placeholder_filename == UNSET_VALUE @resolve_options = {} if @resolve_options == UNSET_VALUE @use_v1_api = '1' if @use_v1_api == UNSET_VALUE @destructive = true if @destructive == UNSET_VALUE end def validate(machine) errors = [] if not @resolve_options.kind_of?(Hash) errors << '`resolve_options` must be a hash' end return { 'vagrant-librarian-puppet' => errors } end def puppetfile_path(puppetfile_dir) @puppetfile_path ||= puppetfile_dir ? File.join(puppetfile_dir, 'Puppetfile') : 'Puppetfile' end def use_v1_api @use_v1_api ||= '1' end def destruct @destruct ||= true end end end end vagrant-librarian-puppet-0.9.2/lib/vagrant-librarian-puppet/action/0000755000175000017500000000000013530570147025246 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/lib/vagrant-librarian-puppet/action/librarian_puppet.rb0000644000175000017500000000536713530570147031146 0ustar gabstergabsterrequire 'librarian/puppet' require 'librarian/action' require "librarian/puppet/action/install" module VagrantPlugins module LibrarianPuppet module Action class Install def initialize(app, env) @app = app @env = env # Config#finalize! SHOULD be called automatically env[:machine].config.librarian_puppet.finalize! end def call(env) config = env[:machine].config.librarian_puppet if provisioned? # NB: Librarian::Puppet::Environment calls `which puppet` so we # need to make sure VAGRANT_HOME/gems/bin has been added to the # path. original_path = ENV['PATH'] bin_path = env[:gems_path].join('bin') ENV['PATH'] = "#{bin_path}#{::File::PATH_SEPARATOR}#{ENV['PATH']}" puppetfile_dirs = config.puppetfile_dir.kind_of?(Array) ? config.puppetfile_dir : [config.puppetfile_dir] puppetfile_dirs.each do |puppetfile_dir| provision(puppetfile_dir, env, config) end # Restore the original path ENV['PATH'] = original_path end @app.call(env) end def provision(puppetfile_dir, env, config) if File.exist? File.join(env[:root_path], config.puppetfile_path(puppetfile_dir)) env[:ui].info "Installing Puppet modules in \"#{puppetfile_dir}\" with Librarian-Puppet..." # Determine if we need to persist placeholder file placeholder_file = File.join( env[:root_path], puppetfile_dir, 'modules', config.placeholder_filename ) if File.exist? placeholder_file placeholder_contents = File.read(placeholder_file) else placeholder_contents = nil end environment = Librarian::Puppet::Environment.new({ :project_path => File.join(env[:root_path], puppetfile_dir) }) environment.config_db.local['destructive'] = config.destructive.to_s environment.config_db.local['use-v1-api'] = config.use_v1_api Librarian::Action::Ensure.new(environment).run Librarian::Action::Resolve.new(environment, config.resolve_options).run Librarian::Puppet::Action::Install.new(environment).run # Persist placeholder if necessary if placeholder_contents != nil File.open(placeholder_file, 'w') { |file| file.write(placeholder_contents) } end end end def provisioned? @env[:provision_enabled].nil? ? true : @env[:provision_enabled] end end end end end vagrant-librarian-puppet-0.9.2/lib/vagrant-librarian-puppet.rb0000644000175000017500000000012513530570147024314 0ustar gabstergabsterrequire "vagrant-librarian-puppet/version" require "vagrant-librarian-puppet/plugin" vagrant-librarian-puppet-0.9.2/environments/0000755000175000017500000000000013530570147021034 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/environments/multidir/0000755000175000017500000000000013530570147022665 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/environments/multidir/manifests/0000755000175000017500000000000013530570147024656 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/environments/multidir/manifests/site.pp0000644000175000017500000000011613530570147026161 0ustar gabstergabsterclass dev { include git include supervisor include ntp } include dev vagrant-librarian-puppet-0.9.2/environments/default/0000755000175000017500000000000013530570147022460 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/environments/default/manifests/0000755000175000017500000000000013530570147024451 5ustar gabstergabstervagrant-librarian-puppet-0.9.2/environments/default/manifests/site.pp0000644000175000017500000000010013530570147025745 0ustar gabstergabsterclass dev { include git include supervisor } include dev vagrant-librarian-puppet-0.9.2/Vagrantfile0000644000175000017500000000222613530570147020474 0ustar gabstergabster#!/usr/bin/env ruby # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure('2') do |config| # box needs to provide puppet >= 4 config.vm.box = 'puppetlabs/ubuntu-12.04-64-puppet' config.vm.define "default" do |default| default.librarian_puppet.puppetfile_dir = 'puppet' default.librarian_puppet.placeholder_filename = ".gitkeep" default.librarian_puppet.resolve_options = { :force => true } default.librarian_puppet.destructive = false default.vm.provision :puppet do |puppet| puppet.environment_path = "environments" puppet.environment = "default" puppet.module_path = 'puppet/modules' end end config.vm.define "multidir" do |multidir| multidir.librarian_puppet.puppetfile_dir = ['puppet', 'puppet_custom'] multidir.librarian_puppet.placeholder_filename = ".gitkeep" multidir.librarian_puppet.resolve_options = { :force => true } multidir.librarian_puppet.destructive = false multidir.vm.provision :puppet do |puppet| puppet.environment_path = "environments" puppet.environment = "multidir" puppet.module_path = ['puppet_custom/modules', 'puppet/modules'] end end end vagrant-librarian-puppet-0.9.2/Rakefile0000644000175000017500000000003413530570147017747 0ustar gabstergabsterrequire "bundler/gem_tasks" vagrant-librarian-puppet-0.9.2/README.md0000644000175000017500000000422013530570147017562 0ustar gabstergabster# vagrant-librarian-puppet A [Vagrant](http://www.vagrantup.com/) plugin to install [Puppet](http://docs.puppetlabs.com/#puppetpuppet) modules using [Librarian-Puppet](https://github.com/rodjek/librarian-puppet). ## Requirements * Vagrant version 1.2.0 or greater. ## Installation ``` bash vagrant plugin install vagrant-librarian-puppet ``` ## Usage Vagrant will automatically run Librarian-Puppet before any provisioning step, so simply set up your Puppetfile as you normally would. You may specify the subdirectory within which to run `librarian-puppet` using the `librarian_puppet.puppetfile_dir` config key. Please keep in mind that you will need to explicitly set the `modules` path in the `:puppet` provisioner and this path must exist before running vagrant commands. Like the `puppet.module_path`, `librarian_puppet.puppetfile_dir` supports both, a simple String or an Array of Strings. Librarian Puppet will look for Puppetfiles in each Directory and manage each modules directory. **NOTE:** Since the puppet provisioner will fail if the path provided to "puppet.modules" doesn't exist and librarian-puppet will destroy and recreate the modules directory on each run, this plugin supports a placeholder file within the modules directory that can be checked into version control and will persist between provisions. ```ruby Vagrant.configure("2") do |config| config.librarian_puppet.puppetfile_dir = "puppet" # placeholder_filename defaults to .PLACEHOLDER config.librarian_puppet.placeholder_filename = ".MYPLACEHOLDER" config.librarian_puppet.use_v1_api = '1' # Check https://github.com/rodjek/librarian-puppet#how-to-use config.librarian_puppet.destructive = false # Check https://github.com/rodjek/librarian-puppet#how-to-use config.vm.provision :puppet do |puppet| puppet.module_path = "puppet/modules" ... end end ``` ## Development ``` bash bundle bundle exec vagrant up ``` ## Acknowledgements Thanks to @jimmycuadra and other contributors for their work on [vagrant-librarian-chef](https://github.com/jimmycuadra/vagrant-librarian-chef). This plugin made some slight changes to work with puppet, but largely just used their code. vagrant-librarian-puppet-0.9.2/LICENSE.txt0000644000175000017500000000205513530570147020132 0ustar gabstergabsterCopyright (c) 2013 Jimmy Cuadra MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. vagrant-librarian-puppet-0.9.2/Gemfile0000644000175000017500000000032013530570147017573 0ustar gabstergabstersource 'https://rubygems.org' gemspec group :development do gem 'vagrant', github: 'mitchellh/vagrant', ref: 'v1.8.1' gem 'byebug' end group :plugins do gem 'vagrant-librarian-puppet', path: '.' end vagrant-librarian-puppet-0.9.2/CHANGELOG.md0000644000175000017500000000041713530570147020120 0ustar gabstergabsterChangelog for Vagrant Librarian Puppet === `v0.9.2` -- * update vagrant version to 1.8.1 * update gemspec to require puppet 4.3.2 `v0.9.1` -- * bump librarian-puppet gem version to ~> 2.2.1 to fix forge module resolution * update vagrant sanity test * README fixes vagrant-librarian-puppet-0.9.2/.gitignore0000644000175000017500000000032713530570147020277 0ustar gabstergabster*.gem *.rbc .bundle .config .yardoc Gemfile.lock InstalledFiles _yardoc coverage doc/ lib/bundler/man pkg rdoc spec/reports test/tmp test/version_tmp tmp Puppetfile.lock modules .vagrant .tmp puppet/ puppet_custom/