Module: Capistrano::Configuration::Groups
- Included in:
- Capistrano::Configuration
- Defined in:
- lib/capistrano/ec2group.rb
Instance Method Summary collapse
-
#group(which, *args) ⇒ Object
Associate a group of EC2 instances with a role.
Instance Method Details
#group(which, *args) ⇒ Object
Associate a group of EC2 instances with a role. In order to use this, you must use the security groups feature in Amazon EC2 to group your servers by role.
First, specify the security group name, then the roles and params:
group :webserver, :web
group :app_myappname, :app
group "MySQL Servers", :db, :port => 22000
19 20 21 22 23 24 25 |
# File 'lib/capistrano/ec2group.rb', line 19 def group(which, *args) @ec2_api ||= RightAws::Ec2.new(fetch(:aws_access_key_id), fetch(:aws_secret_access_key), fetch(:aws_params, {})) @ec2_api.describe_instances.delete_if{|i| i[:aws_state] != "running"}.each do |instance| server(instance[:dns_name], *args) if instance[:aws_groups].include?(which.to_s) end end |