It should probably look something like this:
//untested command
run_locally("ec2-describe-instances -F vpc-id=1234 -F tag:Env=prod -F
tag:SystemType=worker").each_line do |worker|
server worker, :worker_a
end
notes:
symbols ( the words that start with : ) don't like dashes use underscores and
keep them lowercase.
You can populate roles by passing an array, or you can add individual servers
to a role with the server helper; which lends itself nicely to processing with
each and a block.
I used run_locally both because I believe it is more declarative, ... and my
phone doesn't have back ticks.
On Nov 21, 2011, at 8:55 AM, newguy <[email protected]> wrote:
> Hi guys,
>
> I am trying to use EC2 tools to get all the machines with a particular
> tag in some type of array in /config/deploy/prod.rb file in
> Capistrano. Something like this:
>
> In prod.rb file:
>
> //untested command
> workers-array[]=$(ec2-describe-instances -F vpc-id=1234 -F
> tag:Env=prod -F tag:SystemType=worker)
>
> for(i=0;i<workers-array.len;i++){
> role :worker-A, workers-array[i]
> }
>
> I am not sure how we can do this in capistrano, am new to ruby too.
> Guys any help on this would be really appreciated.
>
> Thanks
>
> --
> * You received this message because you are subscribed to the Google Groups
> "Capistrano" group.
> * To post to this group, send email to [email protected]
> * To unsubscribe from this group, send email to
> [email protected] For more options, visit this group at
> http://groups.google.com/group/capistrano?hl=en
--
* You received this message because you are subscribed to the Google Groups
"Capistrano" group.
* To post to this group, send email to [email protected]
* To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/capistrano?hl=en