capistrano-getservers 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -11
- data/capistrano-getservers.gemspec +1 -1
- data/lib/capistrano-getservers/get_servers.rb +2 -2
- metadata +1 -1
data/README.md
CHANGED
@@ -22,21 +22,11 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
### Server Roles
|
26
|
-
|
27
|
-
All instances are assigned the 'web' role by default, unless you assign
|
28
|
-
an 'app' variable to the particular role you want to add servers to.
|
29
|
-
|
30
|
-
You can change the roles of the servers before they're added by doing
|
31
|
-
something like:
|
32
|
-
|
33
|
-
`set :app, 'database'`
|
34
|
-
|
35
25
|
### Retrieving instances within Capistrano
|
36
26
|
|
37
27
|
In your capistrano script:
|
38
28
|
```ruby
|
39
|
-
get_servers({'app' => 'app_name', 'cluster' => 'cluster', 'environment' => 'environment' ... })
|
29
|
+
get_servers(:db, {'app' => 'app_name', 'cluster' => 'cluster', 'environment' => 'environment' ... })
|
40
30
|
```
|
41
31
|
|
42
32
|
### Retrieving instances from your CLI
|
@@ -53,6 +43,13 @@ Then, via the command line:
|
|
53
43
|
`$ cap staging deploy TAGS=key1:value1,key2:value2,key3:value3...`
|
54
44
|
|
55
45
|
|
46
|
+
### Notes
|
47
|
+
|
48
|
+
All servers will receive the role 'web' unless you specify a different
|
49
|
+
role using the `get_servers` method.
|
50
|
+
|
51
|
+
Example: `get_servers(:role,{})`
|
52
|
+
|
56
53
|
## Contributing
|
57
54
|
|
58
55
|
1. Fork it
|
@@ -5,7 +5,7 @@ require 'capistrano-getservers/get_servers'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "capistrano-getservers"
|
8
|
-
gem.version = '1.0.
|
8
|
+
gem.version = '1.0.1'
|
9
9
|
gem.authors = ["Alfred Moreno"]
|
10
10
|
gem.email = ["alfred.moreno@zumba.com"]
|
11
11
|
gem.description = %q{A capistrano plugin for simplifying EC2 deployment processes}
|
@@ -21,7 +21,7 @@ module Capistrano
|
|
21
21
|
#
|
22
22
|
# Returns: Nothing
|
23
23
|
#############################################################
|
24
|
-
def get_servers cli_tags
|
24
|
+
def get_servers(role=nil, cli_tags)
|
25
25
|
|
26
26
|
ec2 = Fog::Compute::AWS.new(
|
27
27
|
aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
|
@@ -31,7 +31,7 @@ module Capistrano
|
|
31
31
|
ec2.servers.all.each do |instance|
|
32
32
|
begin
|
33
33
|
instance_tags = instance.tags.reject { |k,v| cli_tags[k] != instance.tags[k] }
|
34
|
-
server instance.public_ip_address,
|
34
|
+
server instance.public_ip_address, role || :web if instance_tags.eql? cli_tags
|
35
35
|
rescue => error
|
36
36
|
end
|
37
37
|
end
|