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?
--
Ryan C. Creasey
[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---