Class: YaQueenRoleFontana::Mongo

Inherits:
YaQueen::Base
  • Object
show all
Defined in:
lib/ya_queen_role_fontana/mongo.rb

Instance Method Summary collapse

Instance Method Details

#implement_each_task(host, options) ⇒ Object



26
27
28
29
# File 'lib/ya_queen_role_fontana/mongo.rb', line 26

def implement_each_task(host, options)
  role :mongo, host
  super
end

#implement_role_taskObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ya_queen_role_fontana/mongo.rb', line 9

def implement_role_task
  set :user,          config['user']
  set :mongo_servers, config['servers']

  set :replicasets, config['replicasets']
  set :replicaset_names, replicasets.keys

  (replicasets || {}).each.with_index do |(name, rs), idx|
    role :"#{name}_primary", rs["primary"]
  end

  if sharding = config['sharding']
    set :sharding, sharding
    role :sharding_workspace_host, sharding['workspace_host']
  end
end