On 3/15/07, rcreasey <[EMAIL PROTECTED]> wrote:
>
> I've been trying to extend Capistrano into more than just a web
> application deployment framework and into the realm of system
> administration.
>
> I wanted to write a recipe file that would include common tasks, such
> as adding and deleting system users, but realized that it would only
> really work if I were able to actually get STDIN from the user after
> running cap with the recipe.
>
> I'm thinking of something like this:
>
> desc "Add a user to the specified host"
> task :adduser do
>   puts "Username: "
>   gets username
>   puts "Password: "
>   gets password
>
>   run "/usr/sbin/adduser #{username}"
>   run "/usr/bin/passwd --stdin #{password} | /bin/echo #{password}"
> end
>
> This is a simple kind of example, but you can see what I mean.
> Unfortunately, since (I think) the tasks are Erb templates doing
> methods such as 'gets' doesn't work for variable assignment, and when
> you try to execute a task similar to the one above, it will just skip
> over the 'gets' and complain about the variable not being defined when
> trying to reference it in the following 'puts'.
>
> Any thoughts?
>

I see you answered your won question in this thread, but in general
you should check out deprec(1) to make sure you aren't duplicating
things already done.  Deprec can setup a fresh ubuntu install with
apache, ruby, rails, an app, mongrel, etc...all from one command.  Its
very slick.  There are some similar recipes available from some of the
other folks (some from "slingshot hosting" I think?), if you search
this list you should turn them up.

- Rob

1) http://deprec.rubyforge.org/

--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to