forward3d/cap-ec2 — pull request #28 by eightbitraptor (2014-07-31 15:49:06+00:00)
Title: Provide access to EC2 server tags in Capistrano recipes

I needed a way of being able to access values for custom tags that were set across machines from within a Capistrano recipe.

It allows you to write something like this

task :run_arbitrary_command do
on roles(:web) do |server|
execute :script, server.ec2_tags['tag_name']
end
end

It does this by storing a reference to the AWS Instance ID when the Capistrano server object is created inside the `ec2_role` method.

We can use this id later to rebuild the original `AWS::EC2::Instance` object referring to that server so we can query it for it's tags, which is done by adding a method to the Capistrano Server class so that instances can fetch their own EC2 tags.