solutious/rudy

How do I run routines with parameters?

Closed this issue · 5 comments

I'd like to use Rudy as my main EC2 deployment tool, instead of what I currently use - a bunch of bash scripts. Maybe this question should go to rudy/arcade. I'm also relatively new to Ruby, so I didn't manage to get that from source code. Here are my questions:

  • Can I run routines with params? ( I guess it's a 'yes', but couldn't find an example )
  • What should I say instead of n.times{ ami 'ami-xxxxxxxx'} ?
  • Is there an example of using Rudy functionality in Ruby code that I insert as new commands? Like "get running machines info, put that into a file" or smth.

So, basically, I want more examples, but I'm not yet ready to provide them myself. Would you please enlighten me? :)

Hi Evgeniy,

You're right. There currently aren't many examples!

In your routines.rb:

  machine_info do
      local do 
          disable_safe_mode
          rudy 'machines > path/2/file'
      end
  end

I'd be happy to write more examples if you need them.

Delano

Thank you, that helps a lot. The second question isn't clear at all, now I can see that. What I really meant is:

  • How do I run multiple machines with the same role, preferably variable quantity of them, and then run routines on all machines with the same role in a bunch?

And if that's covered already in arcade, please just point it.

Ah okay, here is an example:

http://github.com/solutious/rudy/blob/master/Rudyfile

Take a look at the :db role. You can specify the number of machines with the "positions" parameter. When you run "rudy startup", rudy will create that number of machines and all routines that you run will be run on all of them. There is also a parallel mode to run the routine on all the machines at the same time:

rudy -P routine-name

That works :) My next question: is there an example of scp usage?
Btw, should we move this QnA session somewhere? I could support a group on google groups or some other service if you like. By supporting I mean just keeping it free of spam.

Good idea!

I created another page on the github wiki:

http://wiki.github.com/solutious/rudy/specific-configuration-examples

Feel free to add more examples or questions. It doesn't notify me of changes so send me a message or email if you need anything from me.