Skip to content

Instantly share code, notes, and snippets.

Created July 30, 2012 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3209014 to your computer and use it in GitHub Desktop.
Save anonymous/3209014 to your computer and use it in GitHub Desktop.
Role options only appear if servers are defined
[me@localhost ~]$ cat rolebug
role :test1, :color => "\033[34m"
role :test2, 'localhost', :color => "\033[34m"
server "localhost", :test1, :test2
task :date1, :roles => [:test1] do
run "date" do |channel, stream, data|
puts "options: #{channel[:server].options}, date: #{data}"
end
end
task :date2, :roles => [:test2] do
run "date" do |channel, stream, data|
puts "options: #{channel[:server].options}, date: #{data}"
end
end
[me@localhost ~]$ cap -f rolebug date1
* executing `date1'
* executing "date"
servers: ["localhost"]
[localhost] executing command
options: {}, date: Mon Jul 30 14:34:11 EDT 2012
command finished in 65ms
[me@localhost ~]$ cap -f rolebug date2
* executing `date2'
* executing "date"
servers: ["localhost"]
[localhost] executing command
options: {:color=>"\e[34m"}, date: Mon Jul 30 14:34:18 EDT 2012
command finished in 104ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment