Re: [capistrano] Defining custom variables per role/environment (and how to access them)

1,080 views
Skip to first unread message

Lee Hambley

unread,
Mar 26, 2013, 5:14:29 AM3/26/13
to capis...@googlegroups.com
Answerd at stack overflow: http://stackoverflow.com/a/15633170/119669


On 26 March 2013 09:18, Jesper Rønn-Jensen <jesp...@gmail.com> wrote:
Hi

I need to add role/environment specific variables for a (legacy) capistrano multi server, multi-role, multi-environment setup.



How can I define a variable in my server configuration, which is accessible from my tasks?

Also I would appreciate any similar examples. Perhaps there is a simpler way than the one I am pursuing here?

Any feedback greatly appreciated :)

/Jesper Rønn-Jensen

--
--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com 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 unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Lee Hambley

unread,
Mar 26, 2013, 8:25:05 AM3/26/13
to capis...@googlegroups.com

On 26 March 2013 12:25, Jesper Rønn-Jensen <jesp...@gmail.com> wrote:
Thanks for your reply. 

Any time, keep in mind, I'm speaking about as-yet unreleased stuff, so YMMV, no warranty, etc.

You iterate over "hosts" in the example like this:

    on hosts do |host|
     ...
  end

When I understand the way it's been build properly (and I haven't written that part of the code myself) - the roles are available through a variable that you can treat in a similar fashion, but `on(roles)` is meaningless, you'd need to do `roles.each { |role| on(role.hosts) }` or something.

However, I haven't written the Cap v3. role code, you'll have to go spelunking in the code, sorry.

Jesper Rønn-Jensen

unread,
Apr 2, 2013, 4:02:50 PM4/2/13
to capis...@googlegroups.com
Just for the record, I ended up staying on Capistrano 2 and created a different solution with a single limitation -- only run against one role at a time.


Thanks a lot for the feedback! 

/Jesper
Reply all
Reply to author
Forward
0 new messages