ec2-clusterssh 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/cluster CHANGED
@@ -4,7 +4,7 @@ require 'optparse'
4
4
  require 'rubygems'
5
5
  require 'aws-sdk'
6
6
 
7
- options = {'tag' => 'role', 'user' => 'ec2-user'}
7
+ options = {'tag' => 'role', 'user' => 'ec2-user', 'use_private_ip' => false}
8
8
  OptionParser.new do |opts|
9
9
  opts.banner = "Usage: cluster [-t TAG] [-l USER] [-k KEY -s SECRET] [-r region] -v VALUES"
10
10
 
@@ -31,6 +31,10 @@ OptionParser.new do |opts|
31
31
  opts.on("-r", "--region [REGION]", "AWS region") do |opt|
32
32
  options['region'] = opt
33
33
  end
34
+
35
+ opts.on("-p", "--use-private-ip", "Use private IP (default #{options['use_private_ip']})") do
36
+ options['use_private_ip'] = true
37
+ end
34
38
  end.parse!
35
39
 
36
40
  if !options['aws_secret_key'].nil? && !options['aws_access_key'].nil?
@@ -42,7 +46,13 @@ if !options['region'].nil?
42
46
  end
43
47
 
44
48
  ec2 = AWS.ec2
45
- dns = ec2.instances.tagged(options['tag']).tagged_values(options['values']).map{|instance| instance.dns_name}
49
+ dns = nil
50
+ if options['use_private_ip']
51
+ dns = ec2.instances.tagged(options['tag']).tagged_values(options['values']).map{|instance| instance.private_ip_address}
52
+ else
53
+ dns = ec2.instances.tagged(options['tag']).tagged_values(options['values']).map{|instance| instance.dns_name}
54
+ end
55
+
46
56
 
47
57
  cssh = (/darwin/ =~ RUBY_PLATFORM) ? 'csshX' : 'cssh'
48
58
 
@@ -1,5 +1,5 @@
1
1
  module Ec2
2
2
  module Clusterssh
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ec2-clusterssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-20 00:00:00.000000000 Z
12
+ date: 2014-05-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -89,18 +89,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  - - '>='
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
- segments:
93
- - 0
94
- hash: -1450336275784820976
95
92
  required_rubygems_version: !ruby/object:Gem::Requirement
96
93
  none: false
97
94
  requirements:
98
95
  - - '>='
99
96
  - !ruby/object:Gem::Version
100
97
  version: '0'
101
- segments:
102
- - 0
103
- hash: -1450336275784820976
104
98
  requirements: []
105
99
  rubyforge_project:
106
100
  rubygems_version: 1.8.25