├── test ├── foo ├── node.json ├── recipe.rb └── Vagrantfile ├── Rakefile ├── lib ├── vagrant-itamae.rb └── vagrant-itamae │ ├── version.rb │ ├── plugin.rb │ ├── provisioner.rb │ └── config.rb ├── .gitignore ├── Gemfile ├── vagrant-itamae.gemspec ├── LICENSE.txt ├── README.md └── CHANGELOG.md /test/foo: -------------------------------------------------------------------------------- 1 | Hello 2 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | -------------------------------------------------------------------------------- /test/node.json: -------------------------------------------------------------------------------- 1 | {"file_source": "foo"} 2 | -------------------------------------------------------------------------------- /lib/vagrant-itamae.rb: -------------------------------------------------------------------------------- 1 | require "vagrant-itamae/version" 2 | require 'vagrant-itamae/plugin' 3 | -------------------------------------------------------------------------------- /lib/vagrant-itamae/version.rb: -------------------------------------------------------------------------------- 1 | module Vagrant 2 | module Itamae 3 | VERSION = "0.2.1" 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | *.bundle 11 | *.so 12 | *.o 13 | *.a 14 | mkmf.log 15 | .vagrant 16 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | group :development do 4 | gem 'vagrant', github: 'mitchellh/vagrant' 5 | end 6 | 7 | group :plugins do 8 | gem "vagrant-itamae", path: "." 9 | end 10 | 11 | # Specify your gem's dependencies in vagrant-itamae.gemspec 12 | gemspec 13 | -------------------------------------------------------------------------------- /test/recipe.rb: -------------------------------------------------------------------------------- 1 | package "git" do 2 | action :install 3 | end 4 | 5 | remote_file '/home/vagrant/foo' do 6 | source node['file_source'] 7 | end 8 | 9 | directory '/tmp/itamae' do 10 | action :create 11 | mode '0777' 12 | owner 'vagrant' 13 | group 'vagrant' 14 | end 15 | 16 | -------------------------------------------------------------------------------- /lib/vagrant-itamae/plugin.rb: -------------------------------------------------------------------------------- 1 | module VagrantPlugins 2 | module Itamae 3 | class Plugin < Vagrant.plugin('2') 4 | name 'itamae' 5 | provisioner(:itamae) do 6 | require_relative 'provisioner' 7 | Provisioner 8 | end 9 | 10 | config(:itamae, :provisioner) do 11 | require_relative 'config' 12 | Config 13 | end 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /test/Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.require_plugin('vagrant-itamae') 2 | # vi: set ft=ruby : 3 | 4 | VAGRANTFILE_API_VERSION = "2" 5 | 6 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 7 | config.vm.box = "ubuntu/trusty64" 8 | 9 | config.vm.provision :itamae do |config| 10 | config.recipes = ['./recipe.rb'] 11 | config.json = './node.json' 12 | 13 | config.sudo = true 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /lib/vagrant-itamae/provisioner.rb: -------------------------------------------------------------------------------- 1 | require 'itamae' 2 | 3 | module VagrantPlugins 4 | module Itamae 5 | class Provisioner < Vagrant.plugin('2', :provisioner) 6 | def provision 7 | options = { 8 | node_json: config.json, 9 | node_yaml: config.yaml, 10 | sudo: config.sudo, 11 | shell: config.shell, 12 | host: @machine.ssh_info[:host], 13 | port: @machine.ssh_info[:port], 14 | user: @machine.ssh_info[:username], 15 | key: @machine.ssh_info[:private_key_path][0] 16 | } 17 | 18 | ::Itamae.logger.level = config.log_level 19 | ::Itamae::Runner.run(config.recipes, :ssh, options) 20 | end 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /vagrant-itamae.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | lib = File.expand_path('../lib', __FILE__) 3 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 4 | require 'vagrant-itamae/version' 5 | 6 | Gem::Specification.new do |spec| 7 | spec.name = "vagrant-itamae" 8 | spec.version = Vagrant::Itamae::VERSION 9 | spec.authors = ["chiastolite"] 10 | spec.email = ["chiastolite.1980@gmail.com"] 11 | spec.summary = %q{Vagrant plugin for itamae} 12 | spec.description = %q{Vagrant plugin for itamae} 13 | spec.homepage = "" 14 | spec.license = "MIT" 15 | 16 | spec.files = `git ls-files -z`.split("\x0") 17 | spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } 18 | spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) 19 | spec.require_paths = ["lib"] 20 | 21 | spec.add_dependency 'itamae', '~> 1.0', '>= 1.0.8' 22 | 23 | spec.add_development_dependency "bundler", "~> 1.6" 24 | spec.add_development_dependency "rake", "~> 10.0" 25 | end 26 | -------------------------------------------------------------------------------- /lib/vagrant-itamae/config.rb: -------------------------------------------------------------------------------- 1 | require 'logger' 2 | 3 | module VagrantPlugins 4 | module Itamae 5 | class Config < Vagrant.plugin('2', :config) 6 | attr_accessor :json 7 | attr_accessor :yaml 8 | attr_accessor :sudo 9 | attr_accessor :recipes 10 | attr_accessor :shell 11 | attr_accessor :log_level 12 | 13 | def initialize 14 | @recipes = UNSET_VALUE 15 | @json = UNSET_VALUE 16 | @yaml = UNSET_VALUE 17 | @sudo = UNSET_VALUE 18 | @shell = UNSET_VALUE 19 | @log_level = UNSET_VALUE 20 | end 21 | 22 | def finalize! 23 | @recipes = [] if @recipes == UNSET_VALUE 24 | @recipes = Array(@recipes) 25 | 26 | @json = nil if @json == UNSET_VALUE 27 | @yaml = nil if @yaml == UNSET_VALUE 28 | @shell = nil if @shell == UNSET_VALUE 29 | 30 | @sudo = false if @sudo == UNSET_VALUE 31 | 32 | @log_level = ::Logger.const_get((@log_level == UNSET_VALUE ? :info : @log_level).upcase) 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 chiastolite 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vagrant-itamae 2 | 3 | vagrant-itamae is a vagrant plugin for [Itamae](https://github.com/ryotarai/itamae) 4 | 5 | ## Example 6 | 7 | ```ruby 8 | Vagrant.configure('2') do |config| 9 | config.vm.box = "ubuntu/trusty64" 10 | 11 | config.vm.provision :itamae do |config| 12 | # execute command with sudo privilege(true or false) 13 | config.sudo = true 14 | 15 | # recipes(String or Array) 16 | config.recipes = ['./recipe.rb'] 17 | 18 | config.json = './node.json' 19 | end 20 | end 21 | ``` 22 | 23 | ## Installation 24 | 25 | ```ruby 26 | vagrant plugin install vagrant-itamae 27 | ``` 28 | 29 | ## about Itamae plugin 30 | 31 | vagrant-itamae does not support [itamae plugins](https://rubygems.org/search?utf8=%E2%9C%93&query=itamae-plugin). 32 | If you want to use itamae plugins with vagrant-itamae then try to use [vagrant-multiplug](https://github.com/r7kamura/vagrant-multiplug) 33 | 34 | ## Contributing 35 | 36 | 1. Fork it ( https://github.com/chiastolite/vagrant-itamae/fork ) 37 | 2. Create your feature branch (`git checkout -b my-new-feature`) 38 | 3. Commit your changes (`git commit -am 'Add some feature'`) 39 | 4. Push to the branch (`git push origin my-new-feature`) 40 | 5. Create a new Pull Request 41 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [v0.2.1](https://github.com/chiastolite/vagrant-itamae/tree/v0.2.1) (2015-11-23) 4 | [Full Changelog](https://github.com/chiastolite/vagrant-itamae/compare/v0.2.0...v0.2.1) 5 | 6 | **Merged pull requests:** 7 | 8 | - Support log level [\#9](https://github.com/chiastolite/vagrant-itamae/pull/9) ([chiastolite](https://github.com/chiastolite)) 9 | 10 | ## [v0.2.0](https://github.com/chiastolite/vagrant-itamae/tree/v0.2.0) (2015-10-06) 11 | [Full Changelog](https://github.com/chiastolite/vagrant-itamae/compare/v0.1.0...v0.2.0) 12 | 13 | **Merged pull requests:** 14 | 15 | - enable to use 'shell' option [\#8](https://github.com/chiastolite/vagrant-itamae/pull/8) ([3100](https://github.com/3100)) 16 | 17 | ## [v0.1.0](https://github.com/chiastolite/vagrant-itamae/tree/v0.1.0) (2015-01-05) 18 | [Full Changelog](https://github.com/chiastolite/vagrant-itamae/compare/v0.0.1...v0.1.0) 19 | 20 | **Merged pull requests:** 21 | 22 | - Add configuration sudo [\#7](https://github.com/chiastolite/vagrant-itamae/pull/7) ([niku](https://github.com/niku)) 23 | - Support YAML format to Node Attirbutes [\#6](https://github.com/chiastolite/vagrant-itamae/pull/6) ([Tomohiro](https://github.com/Tomohiro)) 24 | 25 | ## [v0.0.1](https://github.com/chiastolite/vagrant-itamae/tree/v0.0.1) (2014-08-07) 26 | **Merged pull requests:** 27 | 28 | - .vagrant directory should be ignored. [\#2](https://github.com/chiastolite/vagrant-itamae/pull/2) ([ryotarai](https://github.com/ryotarai)) 29 | - Fix README markdown. [\#1](https://github.com/chiastolite/vagrant-itamae/pull/1) ([ryotarai](https://github.com/ryotarai)) 30 | 31 | 32 | 33 | \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* --------------------------------------------------------------------------------