vagrant-awsinfo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ DS_Store
@@ -0,0 +1,22 @@
1
+ # vagrant awshost plugin
2
+
3
+ This plug in helps you get some metadata from an Vagrant machine provisioned with the AWS provider
4
+
5
+ This is useful when you use want to find out the external IP of the instance you just provisioned
6
+
7
+
8
+ ## Installing
9
+
10
+ ```vagrant plugin install vagrant-awshost```
11
+
12
+
13
+ ## Querying
14
+
15
+ The `vagrant awshost` command is provided by this plugin.
16
+
17
+ Examples:
18
+
19
+ ```
20
+ % vagrant awshost
21
+ {"host":"ec2-1-2-3-4.compute-1.amazonaws.com","port":22,"private_key_path":"/Users/jdyer/.ssh/example.pem","username":"root"}
22
+ ```
@@ -0,0 +1,6 @@
1
+ # This file is required because Vagrant's plugin system expects
2
+ # a eponymous ruby file matching the rubygem.
3
+ #
4
+ # So this gem is called 'vagrant-awsport' and thus vagrant tries
5
+ # to require "vagrant-awsport"
6
+ require "vagrant-awsinfo/plugin"
@@ -0,0 +1,31 @@
1
+ module VagrantAwsInfo
2
+
3
+ class Command < Vagrant.plugin(2, :command)
4
+
5
+ Settings = Struct.new(:machines)
6
+
7
+ def execute
8
+
9
+ require "optparse"
10
+
11
+ settings = Settings.new
12
+ settings.machines = []
13
+
14
+ options = OptionParser.new do |o|
15
+ o.banner = "Return SSH info from an AWS provisioned Vagrant machine"
16
+ o.on("-m MACHINE", "The machine to query.") do |value|
17
+ settings.machines << value
18
+ end
19
+ end
20
+ settings.machines = ["default"] if settings.machines.empty?
21
+
22
+ with_target_vms(settings.machines) do |machine|
23
+ if machine.provider_name == :aws
24
+ @env.ui.info machine.provider.ssh_info.to_json
25
+ else
26
+ @env.ui.error "Sorry this plugin currently only supports the AWS provider"
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,10 @@
1
+ module VagrantAwsInfo
2
+ class Plugin < Vagrant.plugin("2")
3
+ name "Query SSH info from AWS guests."
4
+
5
+ command "awsinfo" do
6
+ require_relative "command"
7
+ next VagrantAwsInfo::Command
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module VagrantAwsInfo
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-awsinfo/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-awsinfo"
8
+ spec.version = VagrantAwsInfo::VERSION
9
+ spec.authors = ["John Dyer"]
10
+ spec.email = ["johntdyer@gmail.com"]
11
+ spec.description = 'vagrant aws info querying plugin'
12
+ spec.summary = spec.description
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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
+ end
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-awsinfo
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - John Dyer
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-16 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: vagrant aws info querying plugin
15
+ email:
16
+ - johntdyer@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - README.md
23
+ - lib/vagrant-awsinfo.rb
24
+ - lib/vagrant-awsinfo/command.rb
25
+ - lib/vagrant-awsinfo/plugin.rb
26
+ - lib/vagrant-awsinfo/version.rb
27
+ - vagrant-awsinfo.gemspec
28
+ homepage: ''
29
+ licenses:
30
+ - MIT
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 1.8.23
50
+ signing_key:
51
+ specification_version: 3
52
+ summary: vagrant aws info querying plugin
53
+ test_files: []