classify_cluster 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
1
  module ClassifyCluster
2
2
  module Configurator
3
3
  class Cluster
4
- attr_reader :nodes, :name, :classes, :variables, :resources, :hostnames
4
+ attr_reader :nodes, :name, :classes, :variables, :resources, :hostnames, :ssl_pem
5
5
  def initialize(*args, &block)
6
+ @ssl_pem = {}
6
7
  @nodes = {}
7
8
  @variables = {}
8
9
  @resources = []
@@ -27,6 +28,10 @@ module ClassifyCluster
27
28
  end
28
29
  returned
29
30
  end
31
+ def ssl_pem(file_path=nil, module_name=nil)
32
+ return @ssl_pem if file_path.nil? && module_name.nil?
33
+ @ssl_pem = {:file_path => file_path, :module => module_name}
34
+ end
30
35
  def name(value=nil)
31
36
  return @name unless value
32
37
  @name = value
@@ -33,8 +33,6 @@ module ClassifyCluster
33
33
  when "munin"
34
34
  @node.klass "munin::master::onpremise" if @options.has_key?(:master)
35
35
  @node.klass "munin::node::onpremise" if @options.has_key?(:node)
36
- when "cache"
37
- @node.klass "memcached"
38
36
  when "queue"
39
37
  @node.klass "#{@type.to_s}server::onpremise"
40
38
  when "app"
@@ -49,19 +47,21 @@ module ClassifyCluster
49
47
  @node.klass "#{@type.to_s}server::onpremise"
50
48
  when "file"
51
49
  @node.klass "#{@type.to_s}server::onpremise"
50
+ when "cache"
51
+ @node.klass "#{@type.to_s}server::onpremise"
52
52
  end
53
53
  end
54
54
  def add_variable_from_role
55
55
  case @type.to_s
56
56
  when 'app'
57
- @node.cluster.variables['app_servers'] ||= []
58
- @node.cluster.variables['app_servers'] << @node.private_ip
57
+ @node.cluster.variables['app_hosts'] ||= []
58
+ @node.cluster.variables['app_hosts'] << @node.private_ip
59
59
  when 'db'
60
60
  @node.cluster.variable('database_host', @node.private_ip) if @options.has_key?(:primary)
61
61
  when 'queue'
62
62
  @node.cluster.variable 'queue_host', @node.private_ip
63
63
  when 'push'
64
- @node.cluster.variable 'blow_server', @node.private_ip
64
+ @node.cluster.variable 'blow_host', @node.private_ip
65
65
  when 'search'
66
66
  @node.cluster.variable 'solr_host', @node.private_ip
67
67
  when 'munin'
@@ -69,6 +69,8 @@ module ClassifyCluster
69
69
  when 'file'
70
70
  @node.cluster.variables['fileserver_hosts'] ||= []
71
71
  @node.cluster.variables['fileserver_hosts'] << @node.private_ip
72
+ when 'cache'
73
+ @node.cluster.variables 'cache_host', @node.private_ip
72
74
  end
73
75
  end
74
76
  def method_missing(method_name, *args)
@@ -1,3 +1,3 @@
1
1
  module ClassifyCluster
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -1,3 +1,4 @@
1
+ require 'fileutils'
1
2
  module ClassifyCluster
2
3
  module Writers
3
4
  class Puppet
@@ -6,6 +7,12 @@ module ClassifyCluster
6
7
  config = ClassifyCluster::Configurator::Configuration.new(options[:config_file])
7
8
  config.clusters.each_pair do |name, cluster|
8
9
  next if options[:cluster] && !(options[:cluster] == cluster.name.to_s)
10
+ unless cluster.ssl_pem.empty?
11
+ pem_file = "/etc/puppet/modules/#{cluster.ssl_pem[:module]}/files/#{cluster.name.to_s}.#{File.basename(cluster.ssl_pem[:file_path])}"
12
+ FileUtils.cp cluster.ssl_pem[:file_path], pem_file
13
+ FileUtils.chown 'root', 'puppet', pem_file
14
+ FileUtils.chmod 0640, pem_file
15
+ end
9
16
  File.open(File.join(export_to_folder, "#{cluster.name}.pp"), 'w') do |file|
10
17
  cluster.nodes.each_pair do |fqdn, node|
11
18
  file.write(output(%Q%node "#{node.default? ? 'default' : node.fqdn}" {%))
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: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 3
10
- version: 0.2.3
9
+ - 4
10
+ version: 0.2.4
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 00:00:00 -08:00
18
+ date: 2010-11-22 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency