aws2sshconfig 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/bin/aws2sshconfig +44 -0
- metadata +60 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b445ebff31491b05def3076055b94675e0b8c172
|
4
|
+
data.tar.gz: 278437dfb752da855ad7a4a15015aede56bb29e7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3a2c3a6f199d73abb125e7a6424d5849f16ec98afd1e340d8a4d1eec0325a97387fdea8e59d519582142e615a48052a1993f0d3051122a4d1a6aa9aa350a2972
|
7
|
+
data.tar.gz: 50a01bcd2d3454cd1151c677bb4b7e36f866caabe5ce96a6e0ea50e1e1541b46e18df05b45f58a3025e68c21f9184618571710e9f59c95a4fedd92feeb0ff0fd
|
data/bin/aws2sshconfig
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'fog'
|
3
|
+
require 'csv'
|
4
|
+
require 'optparse'
|
5
|
+
require 'pp'
|
6
|
+
|
7
|
+
options = {}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = "Usage: aws2sshconfig [options]"
|
10
|
+
|
11
|
+
opts.on("-p", "--prefix PREFIX", "Prepend PREFIX to Host lines") do |prefix|
|
12
|
+
options[:prefix] = prefix
|
13
|
+
end
|
14
|
+
|
15
|
+
opts.on("-i", "--id", "Append instance ID to Host lines") do |id|
|
16
|
+
options[:id] = id
|
17
|
+
end
|
18
|
+
|
19
|
+
opts.on("-r", "--private-ip", "Use private IP instead of public") do |private_ip|
|
20
|
+
options[:private_ip] = private_ip
|
21
|
+
end
|
22
|
+
|
23
|
+
opts.on("-c", "--credentials FILE", "Load credentials from csv-formatted credentials file") do |file|
|
24
|
+
options[:credentials] = file
|
25
|
+
end
|
26
|
+
end.parse!
|
27
|
+
|
28
|
+
if options[:credentials]
|
29
|
+
creds = CSV.parse(File.read(options[:credentials]), :headers => true)
|
30
|
+
compute = Fog::Compute.new(:provider => 'AWS', :aws_access_key_id => creds.first["Access Key Id"], :aws_secret_access_key => creds.first["Secret Access Key"])
|
31
|
+
else
|
32
|
+
puts "Access Key Id:"
|
33
|
+
access_key = STDIN.readline.gsub("\n","")
|
34
|
+
puts "Secret Access Key:"
|
35
|
+
secret_key = STDIN.readline.gsub("\n","")
|
36
|
+
compute = Fog::Compute.new(:provider => 'AWS', :aws_access_key_id => access_key, :aws_secret_access_key => secret_key)
|
37
|
+
end
|
38
|
+
|
39
|
+
compute.servers.each do |server|
|
40
|
+
next if server.state != 'running'
|
41
|
+
puts "Host #{options[:prefix] ? options[:prefix] + '-' : ''}#{server.tags["Name"]}#{options[:id] ? '-' + server.id : ''}"
|
42
|
+
puts " HostName #{options[:private_ip] ? server.private_ip_address : server.public_ip_address}"
|
43
|
+
puts
|
44
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aws2sshconfig
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bryan Conrad
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fog
|
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
|
+
description: Generate SSH configs from AWS info
|
28
|
+
email: bkconrad@gmail.com
|
29
|
+
executables:
|
30
|
+
- aws2sshconfig
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- bin/aws2sshconfig
|
35
|
+
homepage:
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata: {}
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
requirements: []
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 2.2.2
|
56
|
+
signing_key:
|
57
|
+
specification_version: 4
|
58
|
+
summary: Generate SSH configs from AWS info
|
59
|
+
test_files: []
|
60
|
+
has_rdoc:
|