Module: Capistrano::DSL

Defined in:
lib/capistrano/consul.rb

Instance Method Summary collapse

Instance Method Details

#consul_all_nodes(properties = {}) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/capistrano/consul.rb', line 28

def consul_all_nodes(properties = {})
  Consul.setup
  Diplomat::Node.get_all.each_with_index do |node, index|
    properties[:primary] = true if index == 0
    server(node['Address'], properties)
  end
end

#consul_service(service_name, properties = {}) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/capistrano/consul.rb', line 36

def consul_service(service_name, properties = {})
  Consul.setup
  Diplomat::Service.get(service_name, :all).each_with_index do |node, index|
    properties[:primary] = true if index == 0
    server(node['Address'], properties)
  end
end