Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ Note: Mac users with the latest version of XCode may run into a compilation err
-l, --login [USER] Log in with this user
-t, --tags [TAGS] a 'space' sparated key value pair of tags and values (i.e. -t 'role=web,database environment=dev')
-r, --region [REGION] AWS region
-o, --options [SSH_OPTIONS] ssh options to pass directly to cssh
-s, --screen [SCREEN] What screen to use for clustering windows (form multiple displays)
-p, --use-public-ip Use public IP (default false)


$cluster -t Name=web,database #Connects to all web and database servers
$cluster -t 'role=web,database environment=dev' #Connects to all web and database servers in the dev environment
$cluster -t 'role=web,database environment=dev' -o"-i /Path/to/key.pem" # connect using explicit private key

## Notes

Expand Down
8 changes: 7 additions & 1 deletion bin/cluster
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ options = {
}

OptionParser.new do |opts|
opts.banner = "Usage: cluster [-t TAGS] [-l USER] [-k KEY -s SECRET] [-r region]"
opts.banner = "Usage: cluster [-t TAGS] [-l USER] [-k KEY -s SECRET] [-r region] [-o SSH_OPTIONS]"

opts.on("-l", "--login [USER]", "Log in with this user") do |opt|
options['user'] = opt
Expand All @@ -32,6 +32,11 @@ OptionParser.new do |opts|
options['use_public_ip'] = true
end

#Allow -o to be passed to give specific ssh options
opts.on("-o", "--options [SSH_OPTIONS]", "ssh options to pass directly to cssh") do |opt|
options['SSH_OPTIONS'] = opt
end

end.parse!

Aws.config.update({:region => options['region']})
Expand Down Expand Up @@ -80,6 +85,7 @@ end
cssh = (/darwin/ =~ RUBY_PLATFORM) ? 'csshX' : 'cssh'

cmd = "#{cssh}"
cmd = cmd + " --ssh_args '#{options['SSH_OPTIONS']}'"
cmd = cmd + " -l #{options['user']}" unless options['user'].nil?
cmd = cmd + " -screen #{options['screen']}" unless options['screen'].nil?
cmd = cmd + " #{matched_instances.join ' '}"
Expand Down