vagrant-serverkit 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +3 -0
- data/Gemfile +11 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/Vagrantfile +10 -0
- data/lib/vagrant/serverkit.rb +3 -0
- data/lib/vagrant/serverkit/version.rb +5 -0
- data/lib/vagrant_plugins/serverkit/config.rb +19 -0
- data/lib/vagrant_plugins/serverkit/plugin.rb +19 -0
- data/lib/vagrant_plugins/serverkit/provisioner.rb +77 -0
- data/recipe.yml.erb +5 -0
- data/vagrant-serverkit.gemspec +20 -0
- data/variables.yml +3 -0
- metadata +102 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,7 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            SHA1:
         | 
| 3 | 
            +
              metadata.gz: e863c3973a10242c4e652e9bacb6047a8ab08b81
         | 
| 4 | 
            +
              data.tar.gz: 9e91060d9c03576740897669e1f3ac889369a0f0
         | 
| 5 | 
            +
            SHA512:
         | 
| 6 | 
            +
              metadata.gz: d4bdf4cc9e0969a56eecd686e443f87f00955d3857441248d5834f23b5567830f7faa65d1fda827ec56bb61075b8960db2671cf6b669bd4708847695e239c17e
         | 
| 7 | 
            +
              data.tar.gz: 04950096cb04ef03fb7b0e6ad3ba29bef2e642e040c3ebb3f096f1753e1c77a0c8c669d2082a2f02c6a1cae4c0d1be17f1400aba4f68cfc4b24c90fb9fb1f34d
         | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | @@ -0,0 +1,21 @@ | |
| 1 | 
            +
            The MIT License (MIT)
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Copyright (c) 2015 Ryo Nakamura
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         | 
| 6 | 
            +
            of this software and associated documentation files (the "Software"), to deal
         | 
| 7 | 
            +
            in the Software without restriction, including without limitation the rights
         | 
| 8 | 
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         | 
| 9 | 
            +
            copies of the Software, and to permit persons to whom the Software is
         | 
| 10 | 
            +
            furnished to do so, subject to the following conditions:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            The above copyright notice and this permission notice shall be included in
         | 
| 13 | 
            +
            all copies or substantial portions of the Software.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 16 | 
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 17 | 
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 18 | 
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 19 | 
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         | 
| 20 | 
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         | 
| 21 | 
            +
            THE SOFTWARE.
         | 
    
        data/README.md
    ADDED
    
    | @@ -0,0 +1,54 @@ | |
| 1 | 
            +
            # vagrant-serverkit
         | 
| 2 | 
            +
            [Vagrant](https://github.com/mitchellh/vagrant) plug-in for [Serverkit](https://github.com/r7kamura/serverkit).
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            ## Installation
         | 
| 5 | 
            +
            ```
         | 
| 6 | 
            +
            $ vagrant plugin install vagrant-serverkit
         | 
| 7 | 
            +
            ```
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ## Configuration
         | 
| 10 | 
            +
            The following configurations are available on serverkit provisioner:
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            - `recipe_path` - Path to serverkit recipe (e.g. `"recipe.yml"`)
         | 
| 13 | 
            +
            - `variables_path` - Path to serverkit recipe variables (optional)
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ## Development
         | 
| 16 | 
            +
            For vagrant-serverkit developers, an example Vagrantfile is provided in this repository.
         | 
| 17 | 
            +
            To test provisioning with vagrant-serverkit, execute the following command.
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            ```
         | 
| 20 | 
            +
            $ bundle exec vagrant provision
         | 
| 21 | 
            +
            ```
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            ## Example
         | 
| 24 | 
            +
            Here are example files to provision your vagrant box with Serverkit.
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            ```rb
         | 
| 27 | 
            +
            # Vagrantfile
         | 
| 28 | 
            +
            Vagrant.require_plugin("vagrant-serverkit")
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            Vagrant.configure("2") do |config|
         | 
| 31 | 
            +
              config.vm.box = "ubuntu/trusty64"
         | 
| 32 | 
            +
             | 
| 33 | 
            +
              config.vm.provision :serverkit do |serverkit_config|
         | 
| 34 | 
            +
                serverkit_config.recipe_path = "recipe.yml.erb"
         | 
| 35 | 
            +
                serverkit_config.variables_path = "variables.yml"
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
            end
         | 
| 38 | 
            +
            ```
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            ```erb
         | 
| 41 | 
            +
            # recipe.yml.erb
         | 
| 42 | 
            +
            resources:
         | 
| 43 | 
            +
              <%- package_names.each do |package_name| -%>
         | 
| 44 | 
            +
              - type: package
         | 
| 45 | 
            +
                name: <%= package_name %>
         | 
| 46 | 
            +
              <%- end -%>
         | 
| 47 | 
            +
            ```
         | 
| 48 | 
            +
             | 
| 49 | 
            +
            ```yaml
         | 
| 50 | 
            +
            # variables.yml
         | 
| 51 | 
            +
            package_names:
         | 
| 52 | 
            +
              - vim
         | 
| 53 | 
            +
              - wget
         | 
| 54 | 
            +
            ```
         | 
    
        data/Rakefile
    ADDED
    
    | @@ -0,0 +1 @@ | |
| 1 | 
            +
            require "bundler/gem_tasks"
         | 
    
        data/Vagrantfile
    ADDED
    
    | @@ -0,0 +1,10 @@ | |
| 1 | 
            +
            Vagrant.require_plugin("vagrant-serverkit")
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            Vagrant.configure("2") do |config|
         | 
| 4 | 
            +
              config.vm.box = "ubuntu/trusty64"
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              config.vm.provision :serverkit do |serverkit_config|
         | 
| 7 | 
            +
                serverkit_config.recipe_path = "recipe.yml.erb"
         | 
| 8 | 
            +
                serverkit_config.variables_path = "variables.yml"
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require "vagrant"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module VagrantPlugins
         | 
| 4 | 
            +
              module Serverkit
         | 
| 5 | 
            +
                class Config < Vagrant.plugin("2", :config)
         | 
| 6 | 
            +
                  attr_accessor :recipe_path
         | 
| 7 | 
            +
                  attr_accessor :variables_path
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  # @note Override to make sure that recipe_path is specified
         | 
| 10 | 
            +
                  def validate(machine)
         | 
| 11 | 
            +
                    errors = _detected_errors
         | 
| 12 | 
            +
                    if recipe_path.nil?
         | 
| 13 | 
            +
                      errors << 'Set recipe_path to config (e.g. "recipe.yml")'
         | 
| 14 | 
            +
                    end
         | 
| 15 | 
            +
                    { "serverkit_provider" => errors }
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            require "vagrant"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module VagrantPlugins
         | 
| 4 | 
            +
              module Serverkit
         | 
| 5 | 
            +
                class Plugin < Vagrant.plugin("2")
         | 
| 6 | 
            +
                  name "serverkit"
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  config(:serverkit, :provisioner) do
         | 
| 9 | 
            +
                    require_relative "config"
         | 
| 10 | 
            +
                    Config
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  provisioner(:serverkit) do
         | 
| 14 | 
            +
                    require_relative "provisioner"
         | 
| 15 | 
            +
                    Provisioner
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
            end
         | 
| @@ -0,0 +1,77 @@ | |
| 1 | 
            +
            require "serverkit"
         | 
| 2 | 
            +
            require "vagrant"
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module VagrantPlugins
         | 
| 5 | 
            +
              module Serverkit
         | 
| 6 | 
            +
                class Provisioner < Vagrant.plugin("2", :provisioner)
         | 
| 7 | 
            +
                  def provision
         | 
| 8 | 
            +
                    ::Serverkit::Actions::Apply.new(
         | 
| 9 | 
            +
                      hosts: host,
         | 
| 10 | 
            +
                      recipe_path: config.recipe_path,
         | 
| 11 | 
            +
                      ssh_options: ssh_options,
         | 
| 12 | 
            +
                      variables_path: config.variables_path,
         | 
| 13 | 
            +
                    ).call
         | 
| 14 | 
            +
                  rescue => exception
         | 
| 15 | 
            +
                    raise ServerkitError, exception
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  private
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  # @return [true, nil]
         | 
| 21 | 
            +
                  def forward_agent
         | 
| 22 | 
            +
                    if machine.ssh_info[:forward_agent]
         | 
| 23 | 
            +
                      true
         | 
| 24 | 
            +
                    end
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  # @return [String] Host name of the provisioned machine
         | 
| 28 | 
            +
                  def host
         | 
| 29 | 
            +
                    machine.ssh_info[:host]
         | 
| 30 | 
            +
                  end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  # @return [Fixnum, nil]
         | 
| 33 | 
            +
                  def port
         | 
| 34 | 
            +
                    if machine.ssh_info[:port]
         | 
| 35 | 
            +
                      machine.ssh_info[:port].to_i
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
                  end
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                  # @return [Net::SSH::Proxy::Command, nil]
         | 
| 40 | 
            +
                  def proxy
         | 
| 41 | 
            +
                    if machine.ssh_info[:proxy_command] && machine.ssh_info[:proxy_command] != "none"
         | 
| 42 | 
            +
                      require "net/ssh/proxy/command"
         | 
| 43 | 
            +
                      Net::SSH::Proxy::Command.new(machine.ssh_info[:proxy_command])
         | 
| 44 | 
            +
                    end
         | 
| 45 | 
            +
                  end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                  # @return [Hash<Symbol => Object>] SSH options for Net::SSH.start
         | 
| 48 | 
            +
                  def ssh_options
         | 
| 49 | 
            +
                    {
         | 
| 50 | 
            +
                      forward_agent: forward_agent,
         | 
| 51 | 
            +
                      keys_only: true,
         | 
| 52 | 
            +
                      keys: machine.ssh_info[:private_key_path],
         | 
| 53 | 
            +
                      port: port,
         | 
| 54 | 
            +
                      proxy: proxy,
         | 
| 55 | 
            +
                      user: machine.ssh_info[:username],
         | 
| 56 | 
            +
                      user_known_hosts_file: "/dev/null",
         | 
| 57 | 
            +
                      verbose: :fatal,
         | 
| 58 | 
            +
                    }.reject do |key, value|
         | 
| 59 | 
            +
                      value.nil?
         | 
| 60 | 
            +
                    end
         | 
| 61 | 
            +
                  end
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                  class ServerkitError < Vagrant::Errors::VagrantError
         | 
| 64 | 
            +
                    # @note Override
         | 
| 65 | 
            +
                    def initialize(original_exception)
         | 
| 66 | 
            +
                      @original_exception = original_exception
         | 
| 67 | 
            +
                      super()
         | 
| 68 | 
            +
                    end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                    # @note Override
         | 
| 71 | 
            +
                    def error_message
         | 
| 72 | 
            +
                      @original_exception.to_s
         | 
| 73 | 
            +
                    end
         | 
| 74 | 
            +
                  end
         | 
| 75 | 
            +
                end
         | 
| 76 | 
            +
              end
         | 
| 77 | 
            +
            end
         | 
    
        data/recipe.yml.erb
    ADDED
    
    
| @@ -0,0 +1,20 @@ | |
| 1 | 
            +
            lib = File.expand_path("../lib", __FILE__)
         | 
| 2 | 
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         | 
| 3 | 
            +
            require "vagrant/serverkit/version"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            Gem::Specification.new do |spec|
         | 
| 6 | 
            +
              spec.name          = "vagrant-serverkit"
         | 
| 7 | 
            +
              spec.version       = Vagrant::Serverkit::VERSION
         | 
| 8 | 
            +
              spec.authors       = ["Ryo Nakamura"]
         | 
| 9 | 
            +
              spec.email         = ["r7kamura@gmail.com"]
         | 
| 10 | 
            +
              spec.summary       = "Vagrant plug-in for Serverkit."
         | 
| 11 | 
            +
              spec.homepage      = "https://github.com/r7kamura/vagrant-serverkit"
         | 
| 12 | 
            +
              spec.license       = "MIT"
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         | 
| 15 | 
            +
              spec.require_paths = ["lib"]
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              spec.add_runtime_dependency "serverkit"
         | 
| 18 | 
            +
              spec.add_development_dependency "bundler"
         | 
| 19 | 
            +
              spec.add_development_dependency "rake", "~> 10.0"
         | 
| 20 | 
            +
            end
         | 
    
        data/variables.yml
    ADDED
    
    
    
        metadata
    ADDED
    
    | @@ -0,0 +1,102 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: vagrant-serverkit
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.0.1
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Ryo Nakamura
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2015-04-11 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: serverkit
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - ">="
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '0'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - ">="
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '0'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: bundler
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - ">="
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '0'
         | 
| 34 | 
            +
              type: :development
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - ">="
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '0'
         | 
| 41 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            +
              name: rake
         | 
| 43 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            +
                requirements:
         | 
| 45 | 
            +
                - - "~>"
         | 
| 46 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            +
                    version: '10.0'
         | 
| 48 | 
            +
              type: :development
         | 
| 49 | 
            +
              prerelease: false
         | 
| 50 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            +
                requirements:
         | 
| 52 | 
            +
                - - "~>"
         | 
| 53 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            +
                    version: '10.0'
         | 
| 55 | 
            +
            description: 
         | 
| 56 | 
            +
            email:
         | 
| 57 | 
            +
            - r7kamura@gmail.com
         | 
| 58 | 
            +
            executables: []
         | 
| 59 | 
            +
            extensions: []
         | 
| 60 | 
            +
            extra_rdoc_files: []
         | 
| 61 | 
            +
            files:
         | 
| 62 | 
            +
            - ".gitignore"
         | 
| 63 | 
            +
            - ".travis.yml"
         | 
| 64 | 
            +
            - Gemfile
         | 
| 65 | 
            +
            - LICENSE.txt
         | 
| 66 | 
            +
            - README.md
         | 
| 67 | 
            +
            - Rakefile
         | 
| 68 | 
            +
            - Vagrantfile
         | 
| 69 | 
            +
            - lib/vagrant/serverkit.rb
         | 
| 70 | 
            +
            - lib/vagrant/serverkit/version.rb
         | 
| 71 | 
            +
            - lib/vagrant_plugins/serverkit/config.rb
         | 
| 72 | 
            +
            - lib/vagrant_plugins/serverkit/plugin.rb
         | 
| 73 | 
            +
            - lib/vagrant_plugins/serverkit/provisioner.rb
         | 
| 74 | 
            +
            - recipe.yml.erb
         | 
| 75 | 
            +
            - vagrant-serverkit.gemspec
         | 
| 76 | 
            +
            - variables.yml
         | 
| 77 | 
            +
            homepage: https://github.com/r7kamura/vagrant-serverkit
         | 
| 78 | 
            +
            licenses:
         | 
| 79 | 
            +
            - MIT
         | 
| 80 | 
            +
            metadata: {}
         | 
| 81 | 
            +
            post_install_message: 
         | 
| 82 | 
            +
            rdoc_options: []
         | 
| 83 | 
            +
            require_paths:
         | 
| 84 | 
            +
            - lib
         | 
| 85 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 86 | 
            +
              requirements:
         | 
| 87 | 
            +
              - - ">="
         | 
| 88 | 
            +
                - !ruby/object:Gem::Version
         | 
| 89 | 
            +
                  version: '0'
         | 
| 90 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 91 | 
            +
              requirements:
         | 
| 92 | 
            +
              - - ">="
         | 
| 93 | 
            +
                - !ruby/object:Gem::Version
         | 
| 94 | 
            +
                  version: '0'
         | 
| 95 | 
            +
            requirements: []
         | 
| 96 | 
            +
            rubyforge_project: 
         | 
| 97 | 
            +
            rubygems_version: 2.4.5
         | 
| 98 | 
            +
            signing_key: 
         | 
| 99 | 
            +
            specification_version: 4
         | 
| 100 | 
            +
            summary: Vagrant plug-in for Serverkit.
         | 
| 101 | 
            +
            test_files: []
         | 
| 102 | 
            +
            has_rdoc: 
         |