classify_cluster 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,10 +3,11 @@ module ClassifyCluster
|
|
3
3
|
class Cluster
|
4
4
|
ROLE_2_VARIABLE_MAP = {
|
5
5
|
'app' => ['app_servers', []],
|
6
|
-
'db' => ['
|
7
|
-
'queue' => ['
|
6
|
+
'db' => ['database_host', ''],
|
7
|
+
'queue' => ['queue_host', ''],
|
8
8
|
'push' => ['blow_server', ''],
|
9
|
-
'search' => ['solr_host', '']
|
9
|
+
'search' => ['solr_host', ''],
|
10
|
+
'munin' => ['munin_master', '']
|
10
11
|
}
|
11
12
|
attr_reader :nodes, :name, :classes, :variables, :resources, :hostnames
|
12
13
|
def initialize(*args, &block)
|
@@ -22,7 +23,10 @@ module ClassifyCluster
|
|
22
23
|
@variables['hostnames'] << "#{fqdn}/#{node.private_ip}"
|
23
24
|
node.roles.each do |role|
|
24
25
|
next unless ROLE_2_VARIABLE_MAP.has_key?(role.type.to_s)
|
25
|
-
|
26
|
+
if role.type.to_s == 'munin' && role.options.has_key?('master')
|
27
|
+
@variables['munin_master'] = node.private_ip
|
28
|
+
next
|
29
|
+
end
|
26
30
|
variable_name = ROLE_2_VARIABLE_MAP[role.type.to_s].first
|
27
31
|
variable_initial_value = ROLE_2_VARIABLE_MAP[role.type.to_s][1]
|
28
32
|
@variables[variable_name] = variable_initial_value unless @variables.has_key?(variable_name)
|
@@ -1,6 +1,18 @@
|
|
1
1
|
module ClassifyCluster
|
2
2
|
module Writers
|
3
3
|
class Capistrano
|
4
|
+
CLUSTER_ROLE_2_CAP_ROLE = {
|
5
|
+
'db' => 'db',
|
6
|
+
'queue' => 'rabbitmq',
|
7
|
+
'cron' => 'cron',
|
8
|
+
'app' => 'app',
|
9
|
+
'worker' => 'workling',
|
10
|
+
'munin' => 'munin',
|
11
|
+
'web' => 'web',
|
12
|
+
'push' => 'push',
|
13
|
+
'puppet_master' => 'puppet_master',
|
14
|
+
'search' => 'solr'
|
15
|
+
}
|
4
16
|
def self.export!(capistrano_configurator, cluster, config_file=ClassifyCluster::Base.default_config_file)
|
5
17
|
config = ClassifyCluster::Configurator::Configuration.new(config_file).clusters[cluster]
|
6
18
|
config.variables.each_pair do |name, value|
|
@@ -10,11 +22,7 @@ module ClassifyCluster
|
|
10
22
|
roles = node.roles
|
11
23
|
next if roles.empty?
|
12
24
|
roles.each do |role|
|
13
|
-
|
14
|
-
capistrano_configurator.role('rabbitmq', node.public_ip, role.options)
|
15
|
-
else
|
16
|
-
capistrano_configurator.role(role.type, node.public_ip, role.options)
|
17
|
-
end
|
25
|
+
capistrano_configurator.role((CLUSTER_ROLE_2_CAP_ROLE[role.type.to_s] || role.type.to_s), node.fqdn, role.options)
|
18
26
|
end
|
19
27
|
end
|
20
28
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: classify_cluster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sean Cashin
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-09 00:00:00 -08:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|