tim, that is exactly right, further to that, if you need to set :primary => true or any of the other attributes common to a role() declaration, the lambda must return an array. Personally I might build this like this: http://pastie.org/567750
-- Lee Hambley Twitter: @leehambley Blog: http://lee.hambley.name/ Working with Rails: http://is.gd/1s5W1 2009/7/31 Tim Glen <[email protected]> > > I haven't tried this in action but it appears that you could use a > lambda function to define host in the config? > > set :test_config, lambda{Time.now} > task :foo do > puts test_config > end > > $ cap foo > * executing `foo' > Fri Jul 31 16:31:25 -0400 2009 > > $ cap foo > * executing `foo' > Fri Jul 31 16:31:31 -0400 2009 > > just replace Time.now with whatever you need to grab the host name, > presumably some sort of parsing of ec2-describe-instances or something > similar (like using the right_aws gem) > > hth, > tim > > > On 31-Jul-09, at 1:45 AM, johne wrote: > > > > > Having trouble trying to dynamically set host on a task at runtime. > > Basically I want to set the host dynamically when task is run. I > > tried set with a block, but no luck. > > > > For example, I want this.... > > > > task :mount_ebs, :hosts => host do > > sudo "mkdir /ebs1" > > sudo "mount -t xfs /dev/sdh /ebs1" > > end > > > > where host is dynamically generated at task run time.... > > > > any help greatly appreciated > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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.co.uk/group/capistrano?hl=en -~----------~----~----~----~------~----~------~--~---
