s = <<DATA
PLAY RECAP *********************************************************************
ec2-123.compute-1.amazonaws.com : ok=16 changed=2 unreachable=0 failed=0
ec2-456.compute-1.amazonaws.com : ok=11 changed=0 unreachable=0 failed=0
ec2-766.compute-1.amazonaws.com : ok=40 changed=15 unreachable=0 failed=0
localhost : ok=0 changed=0 unreachable=0 failed=0
DATA
res = s
.scan(/^(ec[0-9]+\S+) : ok=([0-9]+)/)
.to_h.map{ |a, b| [ a,
begin
Integer b
rescue ArgumentError
b
end ]}
.sort_by {|a, b| b}
.to_h
puts res