public
anonymous / gist:3209014
Last active

Role options only appear if servers are defined

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
[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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.